Thank you for the response, but self has a value of OrdersDatabase and stmt has a value of ODBCPreparedStatement, so Im guessing that these are the correct values.
There must be some crucial difference between the SQLitePreparedStatement and the ODBCPreparedStatement that Xojo does not like.
If the super was originally an SQLiteDatabase then why are you running ODBC… statements against it?
Also, I’d suggest you clearly define the database as a global property with an unambiguous name. I suspect references to self may come back to haunt you.
Eddies Electronics is an example of a database program that comes with Xojo. All I am trying to do is use an Access 2007 database that has been converted from the supplied SQLite database.
I am altering the minimum amount of code thats necessary to achieve this.
I am doing this because eventually, I want to be able to use Xojo as the frontend for my existing Access 2007 databases.
I thought that by doing it this way, it would prove to be the easiest way to learn, but I seem to have discovered some anomalies.
A database object has three error properties: Error, ErrorCode, and ErrorMessage. Right after you attempt to get the RecordSet, check to see if Error is true. If so, see what the ErrorMessage says.
The Method FindCustomersByName is defined as a RecordSet, so the use of self in this case seems legitimate, although I thought it was odd at first.
Using Self isnt causing the problem I am having with ODBC Prepared Statements, because I get the same problem if I modify the code in the LoadCustomers Method to avoid calling FindCustomersByName. LoadCustomers Method uses App.Orders instead of Self and causes the same problem.
You will see what I mean if you have a look at the example program Eddies Electronics.
Im using Windows 7 Professional 64 bit with the Xojo ODBC Plug-in.
I expected that others would have encountered this problem, but I cant find any mention on the internet.
Do you have a working ODBC connection on Windows? Was it created using the 32bit version of ODBC (C:\Windows\SysWOW64\odbcad32.exe)? Xojo can’t read 64bit connections.
Here’s what I use to establish connections to SQL Server:
BAP4 = new ODBCDatabase_TT
#if TargetWin32
BAP4.DataSource = "Driver={SQL Server};Server=192.168.242.118;Database=BAP4;UID=user;Pwd=password"
#endif
#if TargetCocoa
BAP4.DataSource = "Driver={Actual SQL Server};Server=192.168.242.118;Database=BAP4;UID=user;Pwd=password"
#endif
if BAP4.Connect then
MsgBox "connected"
else
MsgBox "error: " + BAP4.ErrorMessage
break
end if
On Windows, this code connects using a 32bit User DSN named BAP4.