I'm using VB6 to enumerate the parameteers in SProcs - here's my coded:
For c = 1 To oQueryResults.Columns
tmpString = tmpString & oQueryResults.ColumnName(c) & "=" & _
oQueryResults.GetColumnString(r, c) & " "
Next c
But I'm noticing that the ColumnName is 'name for both the parameter and the
datatype. Here are sample results:
name=@.BillInvNum name=int length=4 colid=1 output=0
name=@.GetAll name=bit length=1 colid=2 output=0
Why are the first two columnnames 'name'? any ideas?Elmo Watson wrote:
> I'm using VB6 to enumerate the parameteers in SProcs - here's my
> coded: For c = 1 To oQueryResults.Columns
> tmpString = tmpString & oQueryResults.ColumnName(c) & "=" & _
> oQueryResults.GetColumnString(r, c) & " "
> Next c
> But I'm noticing that the ColumnName is 'name for both the parameter
> and the datatype. Here are sample results:
> name=@.BillInvNum name=int length=4 colid=1 output=0
> name=@.GetAll name=bit length=1 colid=2 output=0
> Why are the first two columnnames 'name'? any ideas?
Since nobody has answered, I'll take a stab ...
I'm not exactly sure what mechanism is used by DMO to get these results (BOL
doesn't really seem to go into it). To find out, I would use SQL Profiler to
see what commands are actually being run on the server. Then I would analyze
those commands, looking at the procedure definitions if system stored
procedures are being used, or the table/view definitions if tables/views are
being queried directly. This should provide your answer.
Frankly, I would not go through this exercize. I would use the ordinal
position to identify/access the results, perhaps creating an enum or some
constants to make my code a little more readable.
As an alternative to using DMO for this, you might consider using an ADO
Command object, setting its CommandText property to the name of the
procedure and using .Parameters.Refresh to force it to populated the
Parameters collection which can then be enumerated. This will save you the
burden of having to distribut the DMO library with your application, which
is probably already using ADO for other purposes.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Monday, March 19, 2012
DMO Enumerating SProc Parameters
Labels:
codedfor,
columnstmpstring,
database,
dmo,
enumerate,
enumerating,
microsoft,
mysql,
oqueryresults,
oracle,
parameteers,
parameters,
server,
sproc,
sprocs,
sql,
tmpstring,
vb6
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment