好多问题啊,vb & sql

woodmen2 2001-10-23 08:07:37
/* vb中用sql语句*/
Dim Cn as rdoConnection
Dim str as string
Cn.execute(str) 中,如果str是sql的一大段复合语句,这样的话Cn.execute(str)
会不行的(我做的),如果用过程,Cn.execute( )里面该怎么写,那个过程又怎么写?
还有一个问题:
Cn.Execute ("if object_id('testcre2') is not null drop table testcre2") --(1)
Cn.Execute ("create table testcre2 ( i int Not Null,k int Not Null)") --(2)
本来我是没有 testcre2表的,现在第一句没通过,如果把第一句注释掉,第二句通过了,
为什么第一句错了?他报错:无效sql语句,期 待"delete","insert","update","select","procedure"
这到底是什么意思(这样报错)?不支持第一句的语法?我用的是vb6专业英文版
...全文
35 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
woodmen2 2001-10-23
  • 打赏
  • 举报
回复
不是这个原因,写错了一点,str-->strSQL
acev 2001-10-23
  • 打赏
  • 举报
回复
不能用str定义变量.str是个函数

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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