Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
Can anybody please tell me how can I retrieve the data/records (using VBS coding) from Access database and get the retrieved-data stored into a defined variable within the VBScript?
Kindly please send me the coding.
Thanks in advance!

you use it just like in vb.
create an adodb.connection and an adodb.recordset, then connect to the db and load what you want:
Dim CN
Dim RSSet CN = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.RecordSet")CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data source=[FILENAME]" ' Replace [FILENAME] with your file name (path and all)
RS.CursorLocation = 3
RS.Open "SELECT * FROM [TABLENAME]",CN ' replace [TABLENAME] with the table namedo while RS.EOF = false
[MYVARIABLE] = RS("[FIELDNAME]") ' replace [MYVARIABLE] with your variable and [FIELDNAME] with your field name
RS.MoveNext
Loop
RS.CloseCN.Close
Set CN = nothing
Set RS = nothing
enjoy
Chi"They mostly come at night...mostly"

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |