请问:ADO.net中能不能给SQL语句传参数呢?

dujingwei 2005-09-22 10:28:00
ADO.net中有没有像Delphi的中ADO一样,能给SQL语句传参数:
如:
vQuery.SQL.Text:='Slect * from MyTable where ID=:ID';
vQuery.Paramters....
...全文
117 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cubit 2005-09-22
  • 打赏
  • 举报
回复
可以
bingbingcha 2005-09-22
  • 打赏
  • 举报
回复
String strSql = "Slect * from MyTable where ID=?"
cmd.Parameters.Add()

这个是OleDb的写法

SQL的是
String strSql = "Slect * from MyTable where ID=@ID"

mapserver 2005-09-22
  • 打赏
  • 举报
回复
当然可以了。
String strSql = "Slect * from MyTable where ID=?"


cmd.Parameters.Add()

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧