For a project at OneTwo I needed ADODB instead of ODBC to connect to a database. Realbasic/Xojo can do this through the OLEObject, but non of the methods or properties are exposed to the programmer. If you only need it now and then thats not a real problem, but in some cases youll use it all the time. So I decided to write a wrapper around the OLEObjects to make it easier. Also, all available Enums are available (ADOConstants).
[quote=40950:@Alain Bailleul]For a project at OneTwo I needed ADODB instead of ODBC to connect to a database. Realbasic/Xojo can do this through the OLEObject, but non of the methods or properties are exposed to the programmer. If you only need it now and then thats not a real problem, but in some cases youll use it all the time. So I decided to write a wrapper around the OLEObjects to make it easier. Also, all available Enums are available (ADOConstants).
Nice.
Only problem I have when I try to run it from RS2012R2,1 or Xojo2013R3.1 I get Syntax error: attributes as integer in ADOConnection, ADOField, ADOParameter and ADOProperty.
I noticed the code try
return innerConnection.Attributes // Attributes
catch NilObjectException
Return -1
catch OLEException
Return -1
end try
The Attributes displaying the blue colour. I wonder if Xojo and RS2012r2.1 see it as one of its own parameter.
That is indeed a problem. I hadn’t tested it in xojo yet but it does seem Attributes is a xojo keyword. The problem is it can’t be renamed because the OLEObject must use this name. If you don’t use the Atrributes, Just rename them to something else for the moment until I find a solution for this.
There seems to be a problem with the Attributes property in at least Xojo and RS2012R2.1. Because it is a reserved word. This is very unfortunate because this means the full power of ADODB cannot be used in these versions (unless a Xojo guru has an answer to this). If you do not need these properties but still need other stuff from ADODB, you can remove the Attributes property completely from the following classes:
Also make sure you set the correct path to the Test.mdb file in de demo.
Just change to conn.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Test.mdb
In debug mode, disable Break on Exceptions because it stops on every interaction with the OLEObject.
You can edit up until your post is answered or contributed to. Sometimes it requires you to refresh the browser to enable the edit widget. It is accessed in the upper right portion of your post next to the Quote widget.