odbc syntax to update

不羁的心 提交于 2020-01-17 09:08:59

问题


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();

How to provide the referral_email and email using forms?

Do the comment code works in any way??

Please correct the above code


回答1:


Remove the single quote in your command text:

OdbcCommand cmd = new OdbcCommand("UPDATE awm_create 
   SET referral_email=? WHERE email=?" , MyConnection);


来源:https://stackoverflow.com/questions/5173458/odbc-syntax-to-update

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!