Re: Recordset Closed After Having Just Being Opened



Do you have "set nocount on" in the stored proc?


"Karnifexx" <m.p.fletcher@xxxxxxxxxxxxxx> wrote in message
news:1165761611.777992.72620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hey,
If someone could help me with this it would be greatly appreciated.
I have the following code, part of a function (irrevlant and parameter
declaration has been removed). Suffised to say the function works most
of the time and a recordset is usually returned. However sometimes, as
is commented the recordset is closed after the execute statement. What
is causing this to happen?

Dim sqlConn As ADODB.Connection
Dim sqlCmd As ADODB.Command
Dim sqlRS As ADODB.Recordset

' Establish connection.
Set sqlRS = New ADODB.Recordset
Set sqlCmd = New ADODB.Command
Set sqlConn = New ADODB.Connection

sqlConn.ConnectionString = CurrentProject.Connection
sqlConn.Open

sqlConn.CursorLocation = adUseClient 'Cache data locally

' Open recordset.
With sqlCmd
.ActiveConnection = sqlConn
.CommandText = ExecuteSP.Name
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters....(removed)
Set sqlRS = .Execute()
End With

'Here the SP has executed correctly but the sqlRS is closed ;(
???!?!?!?

Regards,
Marc


.



Relevant Pages

  • Re: ADO Recordset Empty After Running SP
    ... Dim sqlConn As ADODB.Connection ... Dim sqlCmd As ADODB.Command ... ' Establish connection. ... Set sqlRS = Nothing ...
    (microsoft.public.access.adp.sqlserver)
  • Re: ADO Recordset Empty After Running SP
    ... Dim sqlConn As ADODB.Connection ... Dim sqlCmd As ADODB.Command ... ' Establish connection. ... Set sqlRS = Nothing ...
    (microsoft.public.access.adp.sqlserver)
  • ADO Recordset Empty After Running SP
    ... Dim sqlConn As ADODB.Connection ... Dim sqlCmd As ADODB.Command ... ' Establish connection. ... Set sqlRS = Nothing ...
    (microsoft.public.access.adp.sqlserver)
  • Recordset Closed After Having Just Being Opened
    ... Dim sqlConn As ADODB.Connection ... Dim sqlCmd As ADODB.Command ... Set sqlRS = New ADODB.Recordset ...
    (microsoft.public.vb.database.ado)
  • Insert New Record
    ... Dim dTable As DataTable ... Dim sqlCmd As SqlCommand ... Dim sqlConn As SqlConnection ...
    (microsoft.public.dotnet.framework.aspnet)

Loading