How to use MySQL in VC, Delphi, VB and other programs (use of MySQL ODBC driver)? We often encounter such problems, how to use the MySQL database in non-web programs or ASP programs? There are two solutions for this problem:
1, the use of MySQL provided by the API function library.
This is how many well-known MySQL client tools are implemented, as is the famous Winmysql tool. This can be achieved in most development tools.
such as VC,BCB,DELPHI,VB and so on, as long as can call the third party API can be achieved. But it is not easy for everyone to be familiar with the requirements of the programmer, and to familiarize yourself with the set of MySQL API functions. And this method cannot be used for programs such as ASP, because it does not support COM objects.
2, the second is the use of the MYODBC driver.
You can download the Myodbc driver to www.mysql.com, and then follow it. The first option is to download the full installation package, this package is very large, but for us to be useful only myodbc.dll this file, but to download such a large file, not very appropriate. Of course, if you are very good, I suggest you choose this way, it is easier, but not in line with Cfans style, yes.
The second is to download the Myodbc.dll file directly, only hundreds of K, but not easy to use, I have been groping for a long time to find the way to use it.
First you untie the package and place the Myodbc.dll file in the Windowssystem or Winntsystem32 directory, depending on whether your system is Win9x or Winnt (Win2K), you should know. Then open a plain text editor, such as Editplus,notpad, (depending on your preference) Save the following passage as a file with the extension. Reg, you know, this is a registry file, don't make a mistake (excluding the following long string equals) If you're using Win2K, change the first line to Windows Registry Editor Version 5.00.
========================================================== from the downside.
Windows Registry Editor Version 4.00
[Hkey_local_machinesoftwareodbcodbcinst. INIMYODBC Driver]
"Usagecount" =dword:00000002
"Driver" = "C:\WINNT\System32\myodbc.dll"
"Setup" = "C:\WINNT\System32\myodbc.dll"
"SQLLevel" = "1"
"FileUsage" = "0"
"DriverODBCVer" = "02.50"
"ConnectFunctions" = "YYY"
"APILevel" = "1"
"CPTimeout" = "120"
[Hkey_local_machinesoftwareodbcodbcinst. INIODBC Drivers]
"MYODBC Driver" = "Installed"
======================================= End With Previous line
(Bill.gates) that's it. After saving, double-click just the file, should be called Xxx.reg Bar, and then choose OK, OK, done. Then you open the ODBC Setup program, build a new data source, select the Myodbc driver, the rest is up to you.