rs.Open Source, Conn, adOpenForwardOnly, adLockReadOnly
Source is a text string and I can copy it into query
analyzer and it runs just fine. I'm using VB6, SQL Server
2000, and ADO 2.6
any suggestions on what to try o rwhat to look at...
Thanks,
Adam
Check if your recordset is not opened already. First you need to close it,
before opening it again.
--
Val Mazur
Microsoft MVP
"Adam Cain" <ac...@smc3.com> wrote in message
news:051901c2b0f1$26675bb0$cef82ecf@TK2MSFTNGXA08...
"Adam Cain" <ac...@smc3.com> wrote in message
news:051901c2b0f1$26675bb0$cef82ecf@TK2MSFTNGXA08...
Public Function LoadRecordset(ByVal Source As String,
Optional ByVal ReadOnly As Boolean = True, Optional ByVal
Track As Boolean) As ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim Conn As New ADODB.Connection
'Set Conn = New ADODB.Connection
Conn.ConnectionTimeout = MAX_CONN_WAIT
Conn.CommandTimeout = MAX_CMD_WAIT
Conn.CursorLocation = adUseClient
Conn.Open CONNECTION_STRING
Set rs.ActiveConnection = Conn
If ReadOnly Then
rs.Open Source, Conn, adOpenForwardOnly,
adLockReadOnly
Else
rs.Open Source, Conn, adOpenKeyset,
adLockOptimistic
End If
Set LoadRecordset = rs
'* SQL analysis
If RunningInIDE And Track Then frmSQL.AddCommand Source
End Function
Then I am calling it from another procdure like this...
Dim rsAgg As ADODB.Recordset
'sql assigned in this chunk as inidicated
Set rsAgg = LoadRecordset(sql, True, True)
In each case the variable is declared within the procedure
and is not used anywhere else.
>.
>
This will return a forwardonly readonly recordset too.
Hope this helps.
Please check this and see.
Ramesh Thyagarajan, MCSD,MCDBA
Microsoft Developer support
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
FYI, I also discovered that it was actually returning as
much of the recordset as my memory could hold but it
didn't seem to send the proper ending of the recordset and
that was what cauesd the error.
Anyway, the problems fixed so thanks for the help.