LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default VB6.0 ADO question

Most of the following code was obtained from Microsoft. (Unsure what I've
changed.) However, it does not work correctly. I'm hoping someone can tell
me why. It actually works until the "GetObjectContext.SetComplete" line us
unremarked. It also bothers me that neither the recordset nor the connection
are closed/terminated nicely.

Public Function ListAll() As ADODB.Recordset

Dim strSQL As String
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection

On Error GoTo ErrorHandler

'Form the SQL SELECT statement
strSQL = "SELECT CategoryId, Name, ModifiedDate, CreatedDate " & _
"FROM Categories ORDER BY Name"

set rs = new ADODB.Recordset
rs.CursorLocation = adUseClient

'Execute the SQL command to the database, using the recordset Open method.
rs.Open strSQL, "FILEDSN=" & fileDSN, adOpenKeyset, adlLockReadOnly,
adCmdText

GetObjectContext.SetComplete

Set ListAll=rs

Exit Function

ErrorHandler:
If Not rs Is Nothing Then
Set rs=Nothing
End If

'Roll back MTS transaction set.
Err.Raise Err.Number, SetErrSource(modName, "ListAll"), Err.Description

GetObjectContext.SetAbort
Err.Raise Err.Number, SetErrSource(modName, "ListAll"), Err.Description

End Function

Thanks in advance,

Christmas May

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
where can I see my question and answer? Yesterday I ask a question IP Excel Discussion (Misc queries) 2 May 10th 08 04:08 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
The question is an excel question that I need to figure out howto do in excel. Terry Excel Worksheet Functions 3 January 23rd 06 06:22 PM
Question Philip Charts and Charting in Excel 1 May 5th 05 11:35 PM


All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"