主题:[原创]数据更新问题,答对加分
check = new SqlConnection("Initial Catalog=test;Data Source=localhost;Integrated Security=SSPI;");
check.Open();
string strUpdt = " UPDATE clothes SET womencoat = " ;
strUpdt += womencoat + women.Text + ",mancoat = " ;
strUpdt += mancoat + man.Text + ",childcoat = " ;
strUpdt += childcoat + child.Text + "" ;
SqlCommand updt = new SqlCommand ( strUpdt,check ) ;
MessageBox.Show(strUpdt);
updt.ExecuteNonQuery ( ) ;
MessageBox.Show("定单成功");
//this.Hide();
check.Close ( ) ;
我的数据库设置了womencoat,mancoat,childcoat都是INT类型,但是我想让它们自加,却不能成功,只能更改,是什么原因呢?语句可行性没问题.
check.Open();
string strUpdt = " UPDATE clothes SET womencoat = " ;
strUpdt += womencoat + women.Text + ",mancoat = " ;
strUpdt += mancoat + man.Text + ",childcoat = " ;
strUpdt += childcoat + child.Text + "" ;
SqlCommand updt = new SqlCommand ( strUpdt,check ) ;
MessageBox.Show(strUpdt);
updt.ExecuteNonQuery ( ) ;
MessageBox.Show("定单成功");
//this.Hide();
check.Close ( ) ;
我的数据库设置了womencoat,mancoat,childcoat都是INT类型,但是我想让它们自加,却不能成功,只能更改,是什么原因呢?语句可行性没问题.