Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Posts
    3

    Unanswered: using vb script to connect to informix

    HI all.

    I'm just starting out in scripting and I'm having a lil problem. I'm trying to connect to an informix db, using vbs, to pull data and I'm receive the error "ODBC driver does not support the requested properties". I've tried googling, but this (scripting) is still very foreign to me. Any help would be greatly appreciated.

    Here's my code:


    Dim Conn
    Set Conn = CreateObject("ADODB.Connection")
    Conn.Open "Driver={IBM INFORMIX ODBC DRIVER};Server=****;Database=****;Trusted_Connecti on=Yes;"

    Dim sql
    sql = "SELECT priority, insurance,patkey FROM tablename where patkey=######"

    Dim rs
    Set rs= CreateObject("ADODB.RecordSet")
    rs.Open sql, conn, 2, 3

    Dim str
    If Not rs.EOF Then
    str = "Patkey=" & rs(0) & ", Priority=" & rs(1) & ", InsCo=" & rs(2) & vbCrLf
    End If

    rs.Close
    Set rs = nothing

    conn.Close
    Set conn = nothing

    GetPatient = str

    msgbox GetPatient

    Also, the error is happening on line 11, char 9.

    Thanks again.

  2. #2
    Join Date
    Jan 2009
    Posts
    3
    i figured out my problem. thanks anyway.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Here's code I use to connect to a data source via vb script (for others looking at these posts.)

    Set WSNet = CreateObject("WScript.Network")

    varUserName = WSNet.UserName

    Set WSNet = Nothing

    Set MyConn = CreateObject("ADODB.Connection")
    Set RS = CreateObject("ADODB.Recordset")

    MyConn.open = "DRIVER={SQL Server};"_
    & "SERVER=SQLSERVER;"_ <- sql server name = SQLSERVER
    & "DATABASE=PKTime;"_ <- db name on sql server = PKTime
    & "OPTION=35;"

    sql_query = "UPDATE dbo.Users SET LoginStatus ='" & "LoggedOut" & "' WHERE LoginID ='" & varUserName & "'" <- for the WriteUserLogOut.vbs
    or
    sql_query = "UPDATE dbo.Users SET LoginStatus ='" & "LoggedIn" & "' WHERE LoginID ='" & varUserName & "'" <- for the WriteUserLogIn.vbs
    'ex: sql_query = "UPDATE dbo.Users SET LoginStatus ='" & "LoggedIn" & "' WHERE LoginID ='" & "PaulK" & "'"

    MyConn.Execute sql_query
    MyConn.Close

    Set RS = Nothing
    Set MyConn = Nothing
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Jan 2009
    Posts
    3
    Thanks pkstormy.

    I have another question, if you don't mind?

    Any idea on how to pass an ahk variable to use within the vbs code? I'm trying to use parsed data and update fields within the db table using those ahk values in vbscript.

    Currently have:

    WS_Eval(theValue, "InsPlanExists(#####, "#####"")")

    Want to have:

    WS_Eval(theValue, "InsPlanExists(*variable from ahk*, "*another variable from ahk*")")

    If you answer, GREAT; and Thank You. If not, Thanks anyway for taking the time out to respond ealier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •