gcue Posted March 21, 2013 Share Posted March 21, 2013 (edited) hello world. I am trying to get the results of this sql query. I am not getting any errors so I think I should be getting results back. thanks in advance! expandcollapse popup#include <array.au3> $msg_normal = 0 $oConn = _SQLConnect($sServer, $sNetworkAddress, $sDatabase, 1, $sUsername, $sPassword) if @error Then MsgBox(0,"","error") EndIf $oCmd = ObjCreate("ADODB.Command") $oCmd.ActiveConnection = $oConn $oCmd.CommandText = "exec storedproc 'XYZ' " $returnVal = $oCmd.Execute $oConn.close debug($returnVal) Func _SQLConnect($sServer, $sNetworkAddress, $sDatabase, $fAuthMode = 0, $sUsername = "", $sPassword = "", $sDriver = "{Sybase ASE ODBC Driver}") Local $sTemp = StringMid($sDriver, 2, StringLen($sDriver) - 2) Local $sKey = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers", $sVal = RegRead($sKey, $sTemp) If @error Or $sVal = "" Then Return SetError(2, 0, 0) $oConn = ObjCreate("ADODB.Connection") If Not IsObj($oConn) Then Return SetError(3, 0, 0) If $fAuthMode Then $oConn.Open("DRIVER=" & $sDriver & ";DSN=" & $sServer & ";NA=" & $sNetworkAddress & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword) If Not $fAuthMode Then $oConn.Open("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase) If @error Then Return SetError(1, 0, 0) Return $oConn EndFunc Func Debug($variable1 = "", $variable2 = "", $variable3 = "") If IsArray($variable1) Then _ArrayDisplay($variable1) Else If $variable2 <> "" Then $variable1 &= @CRLF & $variable2 EndIf If $variable3 <> "" Then $variable1 &= @CRLF & $variable3 EndIf ClipPut($variable1) MsgBox($msg_normal, "Debug", $variable1) EndIf EndFunc ;==>Debug Edited March 21, 2013 by gcue Link to comment Share on other sites More sharing options...
gcue Posted March 21, 2013 Author Share Posted March 21, 2013 got it working through PSALTY's example thanks psalty for sharing and those who helped him! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now