Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I get onto the VB forum -- and use ADO with VFP d
Message
From
24/12/2000 17:21:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00429555
Message ID:
00456712
Views:
31
>>Terry,
>>Generally I wonder when it doesn't work :)
>>It's expected to work. Because you simply add a new property and assign an object ref in one step :)
>Yes, but I never considered CREATEOBJ as adding to the super-class (Maybe that was a form container). I expected to need an AddObject or ADD OBJECT. What is new to me is that the CREATEOBJ is treated like a child of the Super, with some referencing exceptions inside a Super procedure.
>
>>>define class ado as custom olepublic
>>>oConnection=CreateObject("adodb.connection")
>>>enddef
>
>I also noticed that I could not reference inside a com procedure as: THIS.oConnection
>Before the procedure declaration the COM needed to see: oCon=this.oConnection. (wierd)
>About ADODB.Error: Is their a way to trap or reset an Error before the Open method crashes due to quel syntax. With the ADODC (exe) com, there is a 'contained' error method, where I could set some com status flags and return a status string (as well as) a .NULL. Record set.
>
>I'm trying to figure out how to reset (close) the RecordSet Open before it yields to a SQL Error or Provider Error.
>Any ideas?

Connection has errors collection and error object. Sample VB < bg > code from ADO210.chm :
Public Sub DescriptionX()

   Dim cnn1 As ADODB.Connection
   Dim errLoop As ADODB.Error
   Dim strError As String

   On Error GoTo ErrorHandler
   
   ' Intentionally trigger an error.
   Set cnn1 = New ADODB.Connection
   cnn1.Open "nothing"
   
   Exit Sub

ErrorHandler:

   ' Enumerate Errors collection and display 
   ' properties of each Error object.
   For Each errLoop In cnn1.Errors
      strError = "Error #" & errLoop.Number & vbCr & _
         "   " & errLoop.Description & vbCr & _
         "   (Source: " & errLoop.Source & ")" & vbCr & _
         "   (SQL State: " & errLoop.SQLState & ")" & vbCr & _
         "   (NativeError: " & errLoop.NativeError & ")" & vbCr
      If errLoop.HelpFile = "" Then
         strError = strError & _
            "   No Help file available" & _
            vbCr & vbCr
      Else
         strError = strError & _
            "   (HelpFile: " & errLoop.HelpFile & ")" & vbCr & _
            "   (HelpContext: " & errLoop.HelpContext & ")" & _
            vbCr & vbCr
      End If
         

   Debug.Print strError
   Next

   Resume Next

End Sub
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform