怎么在vb中运行多行sql语句?比如说这句
declare@markaint,@markbint,@markcint,@markdint,@markeintselect@marka=count(*)fromSCwh...
declare @marka int,@markb int,@markc int,@markd int,@marke int select @marka= count(*) from SC where Grade>=90
。。。select @marka as more90,@markb as b80a90,@markc as b70a80,@markd as b60a70,@marke as less60
上面的sql语句在查询分析器上有反馈:
但是在vb上运行却没有任何反馈,为什么呢?
另外:我这样运行的(
sqlRc.CursorLocation = adUseClientstr = "declare @marka int,@markb int,@markc int,@markd int,@marke int " & _ "select @marka= count(*) from SC where Grade>=90" & _ "select @marka as more90,@markb as b80a90,@markc as b70a80,@markd as b60a70,@marke as less60"sqlRc.Open str, sqlCnSet DataGrid1.DataSource = sqlRc
) 展开
。。。select @marka as more90,@markb as b80a90,@markc as b70a80,@markd as b60a70,@marke as less60
上面的sql语句在查询分析器上有反馈:
但是在vb上运行却没有任何反馈,为什么呢?
另外:我这样运行的(
sqlRc.CursorLocation = adUseClientstr = "declare @marka int,@markb int,@markc int,@markd int,@marke int " & _ "select @marka= count(*) from SC where Grade>=90" & _ "select @marka as more90,@markb as b80a90,@markc as b70a80,@markd as b60a70,@marke as less60"sqlRc.Open str, sqlCnSet DataGrid1.DataSource = sqlRc
) 展开
3个回答
展开全部
str每行后要加英文的分号“;” , 不返回的我以前试过可以(多条update的),要返回记录集可以这样:set sqlRc = sqlCn.excute(str),我没试过,试试看吧。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
想执行多条sql语句,你可以写个存储过程,然后在vb里调用存储过程
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |