String sql1 =
" UPDATE filename SET @count=@valu2 where @name12=@fname1 ";
stmt = connection_ms.con.createStatement();
stmt.executeUpdate(sql1);
此处valu2
和fname1
是变量,它会给出错误
答案 0 :(得分:0)
如下所示
sqlconnection con=new sqlconnection("your connection string");
string sql1 ="UPDATE filename SET @count=@valu2 where @name12=@fname1 ";
sqlcommand com=new sqlcommand(sql1,con);
com.parameters.addwithvalue("@valu2","enter valu2 here");
com.parameters.addwithvalue("@fname1 ","enter fname1 here");
con.open();
com.executenonquery();
con.close();