Hi,
Use Movenext at the end to move to next row in the table.
Here is the code for that
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
*Do*
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
*RS.MoveNext*
*Loop until RS.EOF*
*--
Regards,
Dhanasekar S.
http://testingideas.wordpress.com
---------------------------------------------------------*
*
*
2009/7/22 Dhanya A <[email protected]>
>
> 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
>
> >
>
--
Regards,
Dhanasekar S.
http://testingideas.wordpress.com
---------------------------------------------------------
Let us make the World Greener
http://www.greenpeace.org/international/
-----------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---