必须声明标量变量 "@UserID".请问怎样解决
1个回答
展开全部
问题出在OleDb和SqlClient 两种Sql参数占位符语法不一样,SqlClient用@代表参数
string str = "select * from user where UserID=@UserID"
而在OleDb中应写成
string str = "select * from user where UserID=?"
然后在OleDbParameter传参中new OleDbParameter[] { new OleDbParameter("@P1", OleDbType.Integer, 4) };
string str = "select * from user where UserID=@UserID"
而在OleDb中应写成
string str = "select * from user where UserID=?"
然后在OleDbParameter传参中new OleDbParameter[] { new OleDbParameter("@P1", OleDbType.Integer, 4) };
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询