string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=localhost;" + "DATABASE=new_db;" + "UID=root;" + "PASSWORD=password;" + "OPTION=3";
OdbcConnection MyConnection = new OdbcConnection(MyConString);
OdbcCommand cmd = new OdbcCommand("UPDATE awm_create SET referral_email=?' WHERE email=? " , MyConnection);
//cmd.Parameters.Add("@tb_refemail", OdbcType.VarChar, 255).Value = tb_refemail.Text.Trim();
//cmd.Parameters.Add("@tb_email", OdbcType.VarChar, 255).Value = tb_email.Text.Trim();
MyConnection.Open();
cmd.ExecuteNonQuery();
如何使用表单提供referral_email和电子邮件?
评论代码是否有效?
请更正上述代码
答案 0 :(得分:1)
删除命令文本中的单引号:
OdbcCommand cmd = new OdbcCommand("UPDATE awm_create
SET referral_email=? WHERE email=?" , MyConnection);