SQL Server带参数的查询语句,怎样用java给参数赋值
Stringsql="select*frommytablewhereusername=@usernameandpassword=@password";...
String sql = "select * from mytable where username = @username and password = @password";
展开
展开全部
string v1_name='sa';
string v2_pass='sa';
String sql = "select * from mytable where username = " + v1_name + " and password = " +v2_pass ;
string v2_pass='sa';
String sql = "select * from mytable where username = " + v1_name + " and password = " +v2_pass ;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select * from mytable where username =? and password =?
然后你设置参数就行了
然后你设置参数就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询