From Pickwiki
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