VB和C ++的SQL查询问题 [英] Sql query issue for VB and C++
问题描述
我在sql vb6.0中有查询,如下所示:
loCon.ExecuteExec('kill& rsa(spid)& ;')
当我用c ++编写相同的查询时它给我一个问题
DB_E_ERRORSINCOMMAND在处理命令期间发生了一个或多个错误
你可以告诉我可能是什么问题,或者我是否必须更新c ++的查询
我的尝试:
Exec('kill(51)' )
Exec('kill(52)')
i have query in sql vb6.0 which is shown below:
loCon.Execute "Exec('kill " & rsa("spid") & "')"
when i wrote same query in c++ it is giving me a issue as
DB_E_ERRORSINCOMMAND One or more errors occurred during processing of command
could you please let me know what might be the issue or whether i have to update the query for c++
What I have tried:
Exec('kill(51)')
Exec('kill(52)')
推荐答案
认为这是SQL Server,KILL
命令不使用括号,请尝试使用
Taken this is SQL Server,KILL
command does not use parenthesis, Have a try with
Exec('kill 51')
另一个是这取决于你使用的库,它可能需要 EXEC
来进行调用。因此,如果问题仍然存在,请尝试执行命令,因为
Another this is that depending on the library you use, it may or may not require EXEC
for the call. So if the problem still remains, try executing the command simply as
kill 51
SQL命令不相同:
The SQL commands are not identical:
-- VB
EXEC('kill id')
-- C++
EXEC('kill(id)')
通过传递<$ c,只需使用与VB代码相同(正确)的语法$ c> id 用空格分隔的参数,而不是用括号括起来。
Just use the same (correct) syntax as in your VB code by passing the id
parameter separated with a space instead of enclosed by parentheses.
这篇关于VB和C ++的SQL查询问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!