FNXBasic and MS Access

In this category you can exchange your programming questions and solutions.
Post Reply
muthym
Posts: 6
Joined: Sat Aug 08, 2009 12:19 pm

FNXBasic and MS Access

Post: # 820Post muthym
Thu Jan 19, 2012 8:00 am

How can I connect MS Access db to FNXBasic?

martiekr
Posts: 4
Joined: Tue Nov 08, 2005 3:00 pm

FNXBasic and MS Access

Post: # 821Post martiekr
Sun Jun 03, 2012 8:10 pm

[quote author=0D151408190D600 link=1326960009/0#0 date=1326960009]How can I connect MS Access db to FNXBasic?[/quote]

It should be possible, using ODBC.
FnxBasic wil let you Declare Windows.DLL`s. One of this DLL`s is the "odbc32.dll". With this DLL you can setup an ODBC connection to any database, like MySQL, PostgreSQL, DB2, Oracle (and MS-Access). I`m currently trying to get this working (using an VB6 working Example). In VB6 this works like a charm. In FnxBasic the code is running without errors but is doing nothing, no errors and no messages. Every "odbc32.dll" call (like this:

``Create an ODBC Environment handle
`Declare Function SQLAllocHandle Lib "odbc32.dll" ( _
`? ?? ?? ?? ?? ?? ?ByVal HandleType As Integer, _
`? ?? ?? ?? ?? ?? ?ByVal InputHandle As Long, _
`? ?? ?? ?? ?? ?? ?ByRef OutputHandle As Long) As Integer
`ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, hEnv) `VB6 Excample Call

dim hEnv as integer

Declare SQLAllocHandle as "SQLAllocHandle" of "odbc32.dll"
? HandleType as Integer
? InputHandle as Integer
? OutputHandle as Integer `? byaddress ??
? result as Integer `returnvalue
End Declare

With SQLAllocHandle
? HandleType? = SQL_HANDLE_ENV
? InputHandle = SQL_NULL_HANDLE
? execute
? hEnv = OutputHandle
? `SHOWMESSAGE "SQLAllocHandle " + result?
end with
)

is running silently, but does nothing.
It should return an Environment Handle (in OutputHandle), needed for the next odbc32.dll call to setup the ODBC-environment for a connection do a ODBC-DSN Connection.
(It does`nt, its just empty, even the `result` variable is empty).
?
I`m still trying to get this working, but i think i don`t know to use the fnxbasic `Declare` statement in the proper way.

Maybe the fnxbasic goeroes can point me in the right direction to show me how to use the Declare statement so that the call returns something.

If i can this ODBC-DSN-Connect get to work, fnxbasic can connect to every (ODBC-aware) Enterprise DBMS.

Post Reply