DB2 URL connection string for VBScript

Hi All,

Can anyone please help me with connection string for DB2 URL connection string using vbscript?


1 answer

IBM AS400 Database access using vbscript uses the iSeries for Windows data connector installed on the IIS server pass SQL string to function, returns array of results.

example: arrResults = DB("select * from library.member")

Private Function DB(strSQL)
	Const adOpenForwardOnly = 0, adOpenStatic = 3, adUseServer = 2, adLockReadOnly = 1
	Dim objRS, strConn
	strConn = "Provider=IBMDA400;" & "Data Source=DataSourceName;" & "User Id=userid;" & "Password=password"
	Set objRS = Server.CreateObject("ADODB.Recordset")
	With objRS
		.CursorType = adOpenForwardOnly
		.CursorLocation = adUseServer
		.LockType = adLockReadOnly
		.ActiveConnection = strConn
		.Source = strSQL
		If .BOF then
			DB = Null
			DB = .GetRows()
		End If
	End With
	Set objRS = Nothing
End Function