Rohit Lal
Rohit Lal

Reputation: 15

vb script connection with db2 10.5

I need connection on vb script with Db2 v10.5 to extract data from db2. DB2 database is on another machine. Though I am using one connection string in VBA excel which is working fine for me however same is not working in VB script.

Connection string in VBA (Excel)

=============================================================

=========================================================================Earlier I am using Microsoft OLEDB provider for db2 in VB script but now I am using IBM db2 Oledb provider. A DB2 client already installed in my machine

Upvotes: 0

Views: 1062

Answers (1)

user6432984
user6432984

Reputation:

In the VBA you have references set to the ActiveX Object Library and you declare your variables as datatype. VBScript doesn't use data type declarations. You need to use CreateObject to Set your object variables.

Set objmyconn = CreateObject("ADODB.Connection")
Set objmycmd = CreateObject("ADODB.Command")
Set objMyRecordset = CreateObject("ADODB.Recordset")

Upvotes: 0

Related Questions