需要在AutoIt中执行SQL查询

发布于 2024-12-05 02:11:50 字数 729 浏览 0 评论 0原文

我想在 AutoIt 中进行数据库操作。我为它编写了一些代码,但它不起作用:

Global $adCN

$adCN = ObjCreate ("ADODB.Connection") ; <== Create SQL connection
$adCN.Open ("DRIVER={SQL Server};SERVER=sqlstaging;DATABASE=NivioAsia2;uid=niviodbstaging;pwd=niviodbstaging;") ; <== Connect with required credentials

if @error Then
    MsgBox(0, "ERROR", "Failed to connect to the database")
    Exit
Else
    MsgBox(0, "Success!", "Connection to database successful!")
EndIf

$sQuery = "select * from irws_m_users where n_userid=10318583224314"

$adCN.Execute($sQuery)

$adCN.Close ; ==> Close the database

Exit

How can I get data from table using AutoIt

I want to do database operations in AutoIt. I written some code for it, but it is not working:

Global $adCN

$adCN = ObjCreate ("ADODB.Connection") ; <== Create SQL connection
$adCN.Open ("DRIVER={SQL Server};SERVER=sqlstaging;DATABASE=NivioAsia2;uid=niviodbstaging;pwd=niviodbstaging;") ; <== Connect with required credentials

if @error Then
    MsgBox(0, "ERROR", "Failed to connect to the database")
    Exit
Else
    MsgBox(0, "Success!", "Connection to database successful!")
EndIf

$sQuery = "select * from irws_m_users where n_userid=10318583224314"

$adCN.Execute($sQuery)

$adCN.Close ; ==> Close the database

Exit

How can I get data from table using AutoIt?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枯寂 2024-12-12 02:11:50

现在已经完成了...

$constrim="DRIVER={SQL Server};SERVER=sqlstaging;DATABASE=NivioAsia2;uid=niviodbstaging;pwd=niviodbstaging;"
$adCN = ObjCreate ("ADODB.Connection") ; <== Create SQL connection
$adCN.Open ($constrim) ; <== Connect with required credentials
MsgBox(0,"",$constrim )

if @error Then
    MsgBox(0, "ERROR", "Failed to connect to the database")
    Exit
Else
    MsgBox(0, "Success!", "Connection to database successful!")
EndIf

$sQuery = "select * from irws_m_users where n_userid=10318583224314"

$result = $adCN.Execute($sQuery)
MsgBox(0, "", $result.Fields( "s_username" ).Value)
$adCN.Close ; ==> Close the database

It's done now...

$constrim="DRIVER={SQL Server};SERVER=sqlstaging;DATABASE=NivioAsia2;uid=niviodbstaging;pwd=niviodbstaging;"
$adCN = ObjCreate ("ADODB.Connection") ; <== Create SQL connection
$adCN.Open ($constrim) ; <== Connect with required credentials
MsgBox(0,"",$constrim )

if @error Then
    MsgBox(0, "ERROR", "Failed to connect to the database")
    Exit
Else
    MsgBox(0, "Success!", "Connection to database successful!")
EndIf

$sQuery = "select * from irws_m_users where n_userid=10318583224314"

$result = $adCN.Execute($sQuery)
MsgBox(0, "", $result.Fields( "s_username" ).Value)
$adCN.Close ; ==> Close the database
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文