s******n 发帖数: 34 | 1 sql server use "Go" to indicate the end of queries.
I executed a batch queries throught ADO, but it would not recognize "Go".
I would like to know if there is some format for the batch, which can be
executed for sql server and oracle, and also could be executed throught the
ADO APIs? I am more interested in the second.
Thanks a lot! |
B*****g 发帖数: 34098 | 2 不是很明白,为啥在ADO里一定要放GO呢?
the
【在 s******n 的大作中提到】 : sql server use "Go" to indicate the end of queries. : I executed a batch queries throught ADO, but it would not recognize "Go". : I would like to know if there is some format for the batch, which can be : executed for sql server and oracle, and also could be executed throught the : ADO APIs? I am more interested in the second. : Thanks a lot!
|
j*****n 发帖数: 1781 | 3 估计后一句需要等前一句完成后才能执行。
我想着LZ 为啥一定就要一次写完呢?在ADO API 里面分两次执行不就完了?
【在 B*****g 的大作中提到】 : 不是很明白,为啥在ADO里一定要放GO呢? : : the
|
s******n 发帖数: 34 | 4 我不是一定要用GO...只是问问有没有类似这样的分开sql语句的符号。
我是把所有要执行的语句(包括创建sp)放在一个文件里的,然后读取整个文件放到
string, 调用ado api执行。
我主要是不想parse文件, 找出有几条语句, 然后一条一条执行。
实际上是通过ado api执行一个batch sql, 但是这个格式不知道是怎样的。
我只知道sql server是通过加一个GO. |
s******n 发帖数: 34 | 5 我就是要先创建若干个sp,然后在执行sp,
我的这些sp是很长的, 不想直接hard code, 而且如果sp有问题, 也不想需要重新
编译程序, 所以我把他们放在一个文件里, 又不想parse文件, 想直接读到
string里, 然后用ADO 执行。
所以我需要知道如果用ado执行batch, 这个语句间是用什么分隔的?
不知道这样讲清楚了没有?
看来只能parse文件了? 或者用ini文件? |
B*****g 发帖数: 34098 | 6 可以在搞一个sp, 执行其他sp
【在 s******n 的大作中提到】 : 我就是要先创建若干个sp,然后在执行sp, : 我的这些sp是很长的, 不想直接hard code, 而且如果sp有问题, 也不想需要重新 : 编译程序, 所以我把他们放在一个文件里, 又不想parse文件, 想直接读到 : string里, 然后用ADO 执行。 : 所以我需要知道如果用ado执行batch, 这个语句间是用什么分隔的? : 不知道这样讲清楚了没有? : 看来只能parse文件了? 或者用ini文件?
|
B*****g 发帖数: 19 | 7 似乎可以放configure file里边,如果不想hard code的话。
VS deployment tool里边可以这样做。
可以考虑写xml然后存储这个sp,其他语言编的程序也可以用。
【在 s******n 的大作中提到】 : 我就是要先创建若干个sp,然后在执行sp, : 我的这些sp是很长的, 不想直接hard code, 而且如果sp有问题, 也不想需要重新 : 编译程序, 所以我把他们放在一个文件里, 又不想parse文件, 想直接读到 : string里, 然后用ADO 执行。 : 所以我需要知道如果用ado执行batch, 这个语句间是用什么分隔的? : 不知道这样讲清楚了没有? : 看来只能parse文件了? 或者用ini文件?
|
B*****g 发帖数: 34098 | 8 没看清楚吓一跳。
【在 B*****g 的大作中提到】 : 似乎可以放configure file里边,如果不想hard code的话。 : VS deployment tool里边可以这样做。 : 可以考虑写xml然后存储这个sp,其他语言编的程序也可以用。
|
B*****g 发帖数: 34098 | 9 没仔细看,这个和oracle有啥关系?
the
【在 s******n 的大作中提到】 : sql server use "Go" to indicate the end of queries. : I executed a batch queries throught ADO, but it would not recognize "Go". : I would like to know if there is some format for the batch, which can be : executed for sql server and oracle, and also could be executed throught the : ADO APIs? I am more interested in the second. : Thanks a lot!
|
B*****g 发帖数: 19 | 10 ado里边对不同的数据库要用不同的protocol吧。
所以你说的语句不认的情况也许是因为对不同版本的oracle应该使用不同的protocol。
【在 B*****g 的大作中提到】 : 没仔细看,这个和oracle有啥关系? : : the
|
B*****g 发帖数: 34098 | 11 connect oracle -- > Don't use ADO.
【在 B*****g 的大作中提到】 : ado里边对不同的数据库要用不同的protocol吧。 : 所以你说的语句不认的情况也许是因为对不同版本的oracle应该使用不同的protocol。
|
s******n 发帖数: 34 | 12 对, 我就想放在config文件里
【在 B*****g 的大作中提到】 : 似乎可以放configure file里边,如果不想hard code的话。 : VS deployment tool里边可以这样做。 : 可以考虑写xml然后存储这个sp,其他语言编的程序也可以用。
|
B*****g 发帖数: 19 | 13 我觉得问题其实在于go是不是一个sql query. 也许Go只是sql server(我想你说得是MS
sqlserver,对吧)的一个软件命令,所以如果你通过ado让server按照sql来执行,恐
怕不行。
就好像dir是系统命令,如果你让ado传给sql server,不会通过。
不一定对,楼主参考。
【在 s******n 的大作中提到】 : 对, 我就想放在config文件里
|
B*****g 发帖数: 34098 | 14 put value in database will be better.
【在 s******n 的大作中提到】 : 对, 我就想放在config文件里
|