OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: How to call C API functions from MS Access ?

From: C.R. Vegelin (vegelinfreeler.nl)
Date: Mon Oct 03 2005 - 15:00:32 CDT


Thanks Shawn,
Your reply was clear. To get MySQLd results I will use ADODB.
I need these results for error trapping and included in my VB code:
   Dim adbError As ADODB.Error
and forced an error with:
   adbConn.Execute ""SELECT a MOD b;"
and finally the trapping code to get the mySQL error messages:
   For Each adbError In conn.Errors
      MsgBox adbError.Description, vbCritical
   Next
It's working !
Thanks again, Cor

----- Original Message -----
From: <SGreenunimin.com>
To: "C.R. Vegelin" <vegelinfreeler.nl>
Cc: <mysqllists.mysql.com>
Sent: Monday, October 03, 2005 5:25 PM
Subject: Re: How to call C API functions from MS Access ?

> "C.R. Vegelin" <vegelinfreeler.nl> wrote on 10/01/2005 03:51:41 AM:
>
>> Hi List,
>>
>> I want to call the C API functions from Visual Basic in MS Access 2003.
>> I assume that I have to use: "c:\Program Files\MySQL\MySQL Server 4.
>> 1\Bin\LibMySQL.dll".
>> In my code at module level I have included various code lines to
>> declare entry-points, such as:
>> Declare Function mysql_info Lib "c:\Program Files\MySQL\MySQL Server
>> 4.1\Bin\LibMySQL.dll" ()
>> Declare Function mysql_stat Lib "c:\Program Files\MySQL\MySQL Server
>> 4.1\Bin\LibMySQL.dll" ()
>>
>> After making an ADODB.Connection and running a query succesfully, I
>> want to call mysql_info().
>> The syntax in C language for this function is: char *mysql_info(MYSQL
> *mysql)
>>
>> My question: how to call mysql_info() from Visual Basic ?
>> When I use: myString = mysql_info() it returns an empty string.
>>
>> My system includes: Windows XP, MySQL 4.1.13 and MyODBC 3.51.11.
>>
>
> To answer the question in your subject: you are already doing that
> correctly. You have selected which library you want to use and are
> declaring the entry points you want to use from that library. Good job.
>
> To see the status of an ADODB connection, you have to use ADODB functions.
> You cannot use the C API functions to check on the status of an ADODB
> process (even if they are sharing the same DLL). That is because the
> client library is thread-safe. Whatever you do in one instance of the
> library is not apparent in any other instance. Any bleed-over from one
> instance to another should be checked against the documentation and if the
> two are not in agreement, report it as a bug.
>
> If you want to use the C API, all of your database calls (including all of
> your SQL execution) need to happen through the C API. If you want to use
> the ADODB objects, you need to connect through ADODB through ODBC and stay
> within that paradigm. You cannot mix or intermingle the two and expect it
> to work. Sorry!
>
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql