QTP Script to get column count of database table - Quick Test Professional Scripts

VBScript to get number of columns(count)present in database table.

We have table "EMP" in database "db"(Microsoft Access).

EMP Table has following data in it.


EMPNO EMPNAME EMPSAL
1 Lakshmi 30,000
2 Laxmi 25,000
3 Latha 15,000


Check This Blog For SQL Queries

Check this post for Script to get column names from database table(MS Access).


Dim con,rs
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
con.provider="microsoft.jet.oledb.4.0"
con.open"d:\db.mdb"
rs.open"select*from EMP",con
column_count=rs.Fields.count
Msgbox column_count

Output:

3

SQL Queries Collection
QTP Script for Connecting to database
QTP Script to export database data to excel sheet
QTP Script to import database data to datatable
Connecting to MSAcess,Oracle,SQL Server Database
Hindi and Telugu Songs Lyrics
QTP Script to get column names from database table(MS Access).

2 comments:

AJ said...

Your blog is very informative, providing generic examples to many a complex problems in QTP scripting.
I see that the link to page "QTP Script to export database data to excel sheet" is broken. Can you please re link the page??

Thanks,
AJ

F n K said...

Here is the link.

Check this for "QTP Script to export database data to excel sheet"

http://funandknowledge.blogspot.com/2008/12/how-to-export-database-data-to.html

Related Posts Plugin for WordPress, Blogger...