vb.net - Full recordset copy from sql to excel using vbscript -


experts please clarify doubt.

i have vb script copy 65 columns of resultset of stored procedure call (which returns 68 columns) excel sheet.

my stored procedure query returns complete recordset, couldn't complete resultset using vbscript. tried specify every column want, tried counting columns alone 50 columns getting excel, not full recordset.

and why first 50 columns, not whole set?

thanks in advance.

i tried display headers in excel (only 50 fields displayed)

for = 1 rstcostbase.fields.count      worksheet.cells(i, 1).value = rstcostbase.fields(i).name   next  

looping through individual row , column got 50 columns data.

assumption: either 1) you're working activex data objects (adodb) or 2) recordsets in vb work similarly...

some time ago found approach on web extract recordsets string in standard .csv formatting. have go , see if helps out.

function recordsettocsv(rsdata adodb.recordset,                          optional showcolumnnames boolean = true,                          optional nullstr string = "") string      dim k long, retstr string = ""      if showcolumnnames         k = 0 rsdata.fields.count - 1             retstr = retstr & ",""" & rsdata.fields(k).name & """"         next k          retstr = mid(retstr, 2) & vbnewline     end if      retstr = retstr & """" & rsdata.getstring(adodb.stringformatenum.adclipstring, -1, """,""", """" & vbnewline & """", nullstr)     retstr = left(retstr, len(retstr) - 3)      return retstr end function 

it's older code checks out...


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -