I want to know the way to export DB data to excel sheet in Qtp. There
were multiple rows in DB results.
Plz check the below piece of code I wrote and correct.
I am having 93 columns in a row. Thatswhy I used loop to write column
values to sheet instead of assigning to rs field name and then
writing.
Set rs = conn1.Execute(query,,adExecuteNoRecords)
colcount= rs.fields.count
Set ex=Createobject("Excel.Application")
Set a=ex.workbooks.open("C:\DB_data.xls")
Set b=a.worksheets("sheet1")
j=1
Do While Not rs.EOF
For i=0 to colcount-1
rval=rs.fields(i).name <!-- Until this step everything is perfect -->
b.cells (j,i).value=rs.fields(i).name.("")
rval=""
next
rs.moveNext
j=j+1
loop
a.save
a.close
--
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 Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
On Mar 13, 11:56 am, Shirish K <shirish1...@gmail.com> wrote:
> Hi,
>
> Once you connected to DB and executed your query then redirect the results
> in to .csv file
> using file system object create file as abc.csv
> write result to file
> save file.
> No need to create the excel file.
>
> .csv you can then directly import in QTP using datatable.import....
>
> -Shirish
>
> > MercuryQTP+...@googlegroups.com<MercuryQTP%2Bunsu...@googlegroups.com>
> > I am having 93 columns in a row. That's why I used loop to write column
-
REGARDS
VISHNU V POTTI
Naresh Kandukuri...
Catch me @ 9989299857