Q
quartz
I am using Windows XP with Office 2003; Microsoft ActiveX Data Objects 2.8
Library;
I am using the following function to execute an ADO query. It works great,
but it doesn't return the field names. How can I get it to do that?
Public Function ADOReturnDisconnectedRecordset(argConnection As String,
argSQL As String) As ADODB.Recordset
'RETURNS A DISCONNECTED ADO RECORDSET TO THE CALLING SUBROUTINE OR FUNCTION
Dim cnADO As ADODB.Connection
Dim rsADO As ADODB.Recordset
Set cnADO = New ADODB.Connection
cnADO.CursorLocation = adUseClient
cnADO.ConnectionString = argConnection
cnADO.CommandTimeout = 0 'NO TIMEOUT
cnADO.Open
Set rsADO = New ADODB.Recordset
rsADO.MaxRecords = 0 '0 = ALL RECORDS
Set rsADO = cnADO.Execute(argSQL)
Set rsADO.ActiveConnection = Nothing 'SEVER CONNECTION
Set ADOReturnDisconnectedRecordset = rsADO.Clone(adLockReadOnly) 'RETURN
CLONE
If rsADO.State = adStateOpen Then rsADO.Close
Set rsADO = Nothing
cnADO.Close
Set cnADO = Nothing
End Function
Please include the correcting line(s). Thanks much in advance.
Library;
I am using the following function to execute an ADO query. It works great,
but it doesn't return the field names. How can I get it to do that?
Public Function ADOReturnDisconnectedRecordset(argConnection As String,
argSQL As String) As ADODB.Recordset
'RETURNS A DISCONNECTED ADO RECORDSET TO THE CALLING SUBROUTINE OR FUNCTION
Dim cnADO As ADODB.Connection
Dim rsADO As ADODB.Recordset
Set cnADO = New ADODB.Connection
cnADO.CursorLocation = adUseClient
cnADO.ConnectionString = argConnection
cnADO.CommandTimeout = 0 'NO TIMEOUT
cnADO.Open
Set rsADO = New ADODB.Recordset
rsADO.MaxRecords = 0 '0 = ALL RECORDS
Set rsADO = cnADO.Execute(argSQL)
Set rsADO.ActiveConnection = Nothing 'SEVER CONNECTION
Set ADOReturnDisconnectedRecordset = rsADO.Clone(adLockReadOnly) 'RETURN
CLONE
If rsADO.State = adStateOpen Then rsADO.Close
Set rsADO = Nothing
cnADO.Close
Set cnADO = Nothing
End Function
Please include the correcting line(s). Thanks much in advance.