简单的任务:连接到数据库,执行存储过程,断开连接
我不一定需要从 VBScript 向存储过程传递任何变量,我只需要在服务器上运行存储过程。我还没有找到任何明确的示例来说明如何执行此操作,只有很多人解释如何将变量从 SP 传递回 VBScript。
任何帮助将不胜感激!看起来我必须打开一个连接,然后发送命令来执行存储过程,然后关闭连接,但我对如何从 VBscript 执行此操作有点迷失。
谢谢!
I don't necessarily need to pass the stored procedures any variables from my VBScript, I just need to run the stored procedure on the server. I haven't been able to find any clear examples of how to do this—just a lot of people explaining how to pass a variable from a SP back to a VBScript.
Any help would be so appreciated! It looks like I'll have to open a connection, then send the command to execute the stored procedure, then close the connection, but I'm a bit lost about how to do this from a VBscript.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
ADODB.Connection
来自 VbScript 的对象检查此示例
you can use the
ADODB.Connection
object from VbScriptcheck this sample
您可以创建如下方法:
注意:此例程假定 SQL 语句是由调用例程构建并正确转义的。此外,
connectionString
是一个常量,您将其与数据库的连接字符串一起存储在某处。调用示例:
You can create a method like this:
Note: This routine assumes that the SQL statement was built by the calling routine and properly escaped. In addition,
connectionString
is a constant that you store somewhere with the connection string to the db.Example call: