sql server - ADO recordset has no recordcount with source set to ADO command (stored procedure) -


i have ado command object in vba running , returning values stored procedure (in sql server). validate sp , command lines in vba, i've used copyfromrecordset method view data , seems fine.

set adocomm = new adodb.command adocomm     .activeconnection = adoconn     .commandtype = adcmdstoredproc     .commandtext = "generatemastersumifs"     .parameters.append .createparameter("importfilepath", advarchar, adparaminput, 100, textfilesavepath) end  set adorec = new adodb.recordset set adorec = adocomm.execute 

i'd able navigate returned records using find or getrows (for example) recordset appears have no data (recordset.recordcount returns -1). i've tried research online , have seen references cursor types being restricted depending on source (in case, sql server) haven't been able find solution can understand , use.

so, question(s), specifically, are:

  1. can continue use ado command/recordset combination collate data 'navigate' it? or
  2. do need run sp using different method enable navigation require?

i'm no expert in field, appreciate patience technical descriptions , site etiquette faux pas.

the solution needed cursorlocation property of ado connection object. changing aduseclient has allowed me move cursor , use methods such find , getrows required.

set adoconn = new adodb.connection adoconn.cursorlocation = aduseclient    adoconn.open "driver={sql server native client 11.0};server=servername;database=dbname;trusted_connection=yes;"  set adocomm = new adodb.command adocomm     .activeconnection = adoconn     .commandtype = adcmdstoredproc     .commandtext = "generatemastersumifs"     .parameters.append .createparameter("importfilepath", advarchar, adparaminput, 100, textfilesavepath)     .parameters.append .createparameter("mtfilepath", advarchar, adparaminput, 100, pathtomt) end  set adorec = new adodb.recordset set adorec = adocomm.execute 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -