Jump to content

Recommended Posts

Posted (edited)

Using the MSSQL.udf

I asked this question once, but haven't had a chance to reply to my old post so posting a new one instead of bouncing the old post.

I'm trying to retrieve data from my database in Microsoft SQL Server 2014. When I tried the code below; empty message box return and no error approaches.

$Connection = _MSSQL_Con($ServerAddress, $ServerUsername, $ServerPassword, $ServerDBName)
    $Testquery = _MSSQL_Query($Connection, "SELECT User_ID From Banker where Manager like '%Jason%'")
    msgbox(0, "Test", $Testquery)
    exit
Edited by Queener

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Posted

Try my ADO.au3 in my signature.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Tried and getting error:

"C:\Program Files (x86)\AutoIt3\Include\ADO.au3" (769) : ==> The requested action with this object has failed.:
$oConnection.Open($sConnectionString)
$oConnection^ ERROR

 

Could it possibly be the DSN because I used the default on your example.

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Posted

Show how You tried.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

I got it to work with this:

 

$sprovider= "sqloledb.1"
$sServer = "Queener\SQLEXPRESS"
$sUser = "sa"
$sPassword = "9999"
$sDatabase = "Bankz"

Local $sConnectionString = 'provider=' & $sprovider & ';SERVER=' & $sServer & ';UID=' & $sUser & ';PWD=' & $sPassword & '; initial catalog=' & $sDatabase
Edited by Queener

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Posted (edited)

This snippet do not show how you use any functions.
CN string looks ok.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...