sql server programming:
[quoted text, click to view] Sa wrote:
> Hello Experts,
>
> I have a stored procedure. I used ADO to called this stored
> procedure. In runtime, it says "No columns defined in rowset".
That does not sound like an ADO error. It sounds more like a T-SQL error.
ADO errors usually refer to recordsets, fields and records. "rowset" makes
it sound
like a T-SQL error.
Have you verified that this procedure runs correctly in Query Analyzer? Like
this:
declare @ret int
exec sp_MigrateAccount 'some session id',@ret output
select @ret [Output Value]
[quoted text, click to view] >
> Here is my stored procedure:
>
> ================================================
> CREATE PROCEDURE [sp_MigrateAccount]
Nothing to do with your error, but using "sp_" for a non-system stored
procedure can cause a slight performance dip, since the query engine treats
all procedures beginning with this prefix as system procedures, looking for
them first in Master, and only looking for them in the current database when
it fails to find them in Master. If you mistakenly name your procedure the
same as a real system procedure, you've got a knotty debugging problem ahead
of you ...
[quoted text, click to view] > @i_vchSessionID VARCHAR(50),
> @o_intRetVal int OUTPUT
> AS
> -- Variables for error handling.
> DECLARE @intError int
<snip>
> SET NOCOUNT ON
I doubt this is the problem, but I generally make this the first statement
in my procedures - before any other statement, even DECLARE's.
[quoted text, click to view] >
<snip>
> =========================================
>
>
> Here is my VBScript that used ADO to call the store procedure:
> ===========================================
> ' :
> ' ADO database connection.....
> ' :
> With ADOCmd
> .CommandText = "sp_MigrateAccount"
> .CommandType = adCmdStoredProc
>
> strInputText = i_strSessionID
> lngParamLen = Len(strInputText)
> If lngParamLen <= 0 Then
> lngParamLen = 1
> End If
> Set ADOParam = .CreateParameter("@i_vchType", adVarChar,
> adParamInput, lngParamLen, strInputText)
> .Parameters.Append ADOParam
>
> Set ADOParam = .CreateParameter("@o_intRetVal",
> adInteger, adParamOutput)
> .Parameters.Append ADOParam
>
> Set .ActiveConnection = objCon
> .Execute
> lngRetVal = .Parameters("@o_intRetVal").Value
> End With
> ' :
> ' :
> ' :
> '=========================================
>
> The ".Execute" statement caused the "No columns defined in rowset".
>
> If I try the following statement:
> .Execute , , (adCmdStoredProc Or adExecuteNoRecords)
Should be:
..Execute , , (adCmdStoredProc + adExecuteNoRecords)
HTH,
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.