Hi ,
Here is the script for finding the number of fields/columns of a Table in MS Access Database.
Code:
Dim db
Set db=createobject("ADODB.Connection")x.ConnectionString="DBQ=C:\PROGRAM FILES\HP\QuickTest Professional\samples\flight\app\flight32.mdb;DefaultDir=C:\PROGRAM FILES\HP\QuickTest Professional\samples\flight\app;Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\flight32.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
db.open
Set RecordSet=db.Execute("Select * from orders")
Set r= RecordSet.fields
msgbox r.count ' Number of the columns in the table 'ORDERS'
For i=0 to r.count-1
msgbox r(i).name ' name of the field/column
Next
db.close
Set db=nothing
First of all. Thanks very much for your useful post.
ReplyDeleteI just came across your blog and wanted to drop you a note telling you how impressed I was with the information you have posted here.
Please let me introduce you some info related to this post and I hope that it is useful for software testing community.
There is a good Software Testing resource site, Have alook
http://SoftwareTestingNet.com
simi