Accessing an SQL Server stored procedure (containing no SELECT statement) from Excel VBA, ideally without using Excel Data Connections? -
i'm trying build vba form runs sql server stored procedure cache data before else. ideally i'd prefer not use excel data connection because can't export new workbook minimum of fuss - it'd nice contain of information in form's file.
the main way know connect vba database using code along these lines:
dim cnn new adodb.connection dim rst new adodb.recordset cnn.open connectionstring rst.open querytext, cnn, adopendynamic /*whatever you're doing data goes here*/ rst.close cnn.close
the problem i'm running caching proc doesn't return dataset (not blank one), , type of connection seems throw tizzy if there no data returned. , i'd prefer not modify proc if don't have to.
is there feasible solution, within these constraints? or being whiny , should suck , use excel data connection or something?
i think looking adodb.command. try this:
dim cnn new adodb.connection dim cmd adodb.command cnn.open connectionstring set cmd = new adodb.command cmd .activeconnection = cnn .commandtext = "exec spnamehere param1" .commandtype = adcmdtext .execute end
Comments
Post a Comment