VBOleDbConnection

From Pickwiki
Revision as of 23:48, 26 February 2015 by Conversion script (talk) (link fix)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Here is a simple VB procedure that shows the OLE connection string needed for UniData connection (you will need to have the Unidata OLE DB client software loaded on your PC)

Sub [[Test_OLE_Connection]]()
    Dim cnnConnection
    Dim rstTable
    Dim strCommand
    Dim strConnect

    Set cnnConnection = [[CreateObject]]("ADODB.Connection")
    Set rstTable = [[CreateObject]]("ADODB.Recordset")

    strConnect = "Provider=Informix.[[UniOLEDB]].1;Password=<password>;User ID=<logon ID>;Data Source=<database name in uci.config>"
   
    cnnConnection.Open strConnect

    'Sample SQL command
    strCommand = "select * from <file name> where ID = '<ID>'"

    rstTable.Open strCommand, cnnConnection, , , 0

    'rest of your code here

End Sub