Jump to content
Sign in to follow this  
carabusu

need help: vbscript to autoit

Recommended Posts

carabusu

how this code look in autoit, i need exactly this code because i have problems with tnsname.ora file and this works in vbscript

tnx

Dim strCon
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
         "CONNECTSTRING=(DESCRIPTION=" & _
         "(ADDRESS=(PROTOCOL=TCP)" & _
         "(HOST=mysrv)(PORT=7001))" & _
         "(CONNECT_DATA=(SERVICE_NAME=MYDB))); uid=read;pwd=read;"

Dim oCon: Set oCon = WScript.CreateObject("ADODB.Connection")
Dim oRs: Set oRs = WScript.CreateObject("ADODB.Recordset")
oCon.Open strCon
Set oRs = oCon.Execute("SELECT myfield FROM mytable)
While Not oRs.EOF
    WSCript.Echo oRs.Fields(0).Value
    oRs.MoveNext
Wend
oCon.Close
Set oRs = Nothing
Set oCon = Nothing

Share this post


Link to post
Share on other sites
PsaltyDS

Well, this has to be closer than what you had, but I can't tell if it's completely right:

Dim $strCon = "Driver={Microsoft ODBC for Oracle}; " & _
         "CONNECTSTRING=(DESCRIPTION=" & _
         "(ADDRESS=(PROTOCOL=TCP)" & _
         "(HOST=mysrv)(PORT=7001))" & _
         "(CONNECT_DATA=(SERVICE_NAME=MYDB))); uid=read;pwd=read;"

Dim $oCon = ObjCreate("ADODB.Connection")
Dim $oRs = ObjCreate("ADODB.Recordset")
$oCon.Open($strCon)
$oRs = $oCon.Execute("SELECT myfield FROM mytable")
While Not $oRs.EOF
    ConsoleWrite($oRs.Fields(0).Value & @LF)
    $oRs.MoveNext
Wend
$oCon.Close
$oRs = ""
$oCon = ""

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×