using (SqlConnection conn = new SqlConnection(ConnString))
{
string insertSql = string.Format("insert into training (trainingcode,trainingname,hours,remark) values ('{0}','{1}',{2},'{3}') ", txtTrainingCode.Text.Trim(), txtTrainingName.Text.Trim(), txtHours.Text.Trim(), rtbRemark.Text.Trim());
{
string insertSql = string.Format("insert into training (trainingcode,trainingname,hours,remark) values ('{0}','{1}',{2},'{3}') ", txtTrainingCode.Text.Trim(), txtTrainingName.Text.Trim(), txtHours.Text.Trim(), rtbRemark.Text.Trim());
SqlCommand command = new SqlCommand(insertSql, conn);
conn.Open();
command.ExecuteNonQuery();
conn.Close();
MessageBox.Show(string.Format("课程-{0} 添加成功",txtTrainingName.Text.Trim()));