Computing.Net > Forums > Programming > VBS - retrieving data from Access

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VBS - retrieving data from Access

Reply to Message Icon

Name: sthchris
Date: December 13, 2004 at 21:45:52 Pacific
OS: Win2000
CPU/Ram: P42K/256MB
Comment:

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!



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: December 15, 2004 at 15:10:54 Pacific
Reply:

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 RS

Set 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 name

do while RS.EOF = false
[MYVARIABLE] = RS("[FIELDNAME]") ' replace [MYVARIABLE] with your variable and [FIELDNAME] with your field name
RS.MoveNext
Loop
RS.Close

CN.Close

Set CN = nothing
Set RS = nothing


enjoy
Chi

"They mostly come at night...mostly"


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VBS - retrieving data from Access

php data from table mysql newbie www.computing.net/answers/programming/php-data-from-table-mysql-newbie/13702.html

retrieving data from mysql using php www.computing.net/answers/programming/retrieving-data-from-mysql-using-php/1483.html

Extracting data from XML to VB 6 www.computing.net/answers/programming/extracting-data-from-xml-to-vb-6/4148.html