Hi All,
I have the following script to connect to SQL database and count the
number of columns in the table specified.I tried to fetch all values
in the specified table. This script is fetching values only from the
first row in the table. Please provide me necessary inputs to modify
the script so that all values in the specified table is fetched.
Option Explicit
Dim con,rs,column_count,column_name, i
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
con.open"provider=sqloledb.1;
server=dbserver;uid=****;pwd=***;database=****"
rs.open"select*from tablename",con
column_count = rs.Fields.count '''''''To get the column count
in specified table
msgbox column_count
For i = 0 to column_count - 1
column_name = rs.Fields(i).Value ''''''To get the columns names in
the specified table
print column_name
Next
Thanks and Regards,
Dhanya A
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---