Search here for all the info you want in this Blog

write a program to connect to database using Vbscript



' creating a datadabse object
Set dobj = createobject("adodb.connection")

'opening  aconnecting
dobj.open("dsn=mydsn;username=;password=")

'executing a query and getting a record set
set rs = dobj.execute("select * from Table1")

' printing the values of the record set
dowhile (not rs.EOF)
columns = rs.Fields.Count
For i=0To columns-1Step1
MsgBox rs.Fields.Item(i).Value
Next
rs.movenext
loop

' closing the data base
dobj.Close

2 comments: