sql和mysql在ado.net参数化查询的小区别
String s1 = "select count(*) fromuser where id=@i ";using (SQLCommand command= new SQLCommand(s1, conn)) {
command.Parameters.Add(new SqlParameter("id",1));}
在sql中,new SqlParameter("id",1)第一个参数id是不用@符号的;
而在mysql中,则需要@
using (MySQLCommand cmd2 = new MySQLCommand(s1, conn)) {
cmd2.Parameters.Add(new MySQLParameter("@i",1));}
页:
[1]