@a7747369string idstring = helper.fid;
using (SqlConnection conn = new SqlConnection(Properties.Settings.Default.Database1ConnectionString))
{ string mystring = Properties.Settings.Default.Database1ConnectionString;
string sqlstring="update [MyTable] set fName=@name,fRemark=
@remark where [MyTable].fid=@idstring";
SqlCommand cmd = new SqlCommand(sqlstring, conn);
try { conn.Open(); string name = textBox1.Text;
string remark = textBox2.Text;
cmd.Parameters.Add("@name", SqlDbType.NChar).Value = name;
cmd.Parameters.Add("@remark", SqlDbType.NChar).Value = remark;
cmd.Parameters.Add("@idstring", SqlDbType.NChar).Value = idstring;
int n=cmd.ExecuteNonQuery();
conn.Close(); Form1.F5(); this.Dispose();
就是这段,我明明没有写错,而且n的值最后也是1,可是数据库里死活都不更新