问题:哪位大侠帮忙解决,我想在VB中读取LINUX下面MYSQL表中的数据应如何做?急盼!!!
回答:
1.首先,确认 MySQL 装在 Linux 正确无误!
(确切地说与 MySQL 的服务器端的操作系统无关,总之客户端既然是 VB,那就必然是 Windows 系列)
2.VB 中可以采用 ODBC + OLE DB 方式连接 MySQL,可在下面页面下载 MyODBC,并安装:
http://210.77.60.218/mirror/mysql/downloads/api-myodbc.html
MyODBC 2.50.39 for Windows95/98 (full setup)
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-win95.zip
MyODBC 2.50.39 for NT/2000 (full setup)
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-nt.zip
MyODBC 2.50.39 Windows95/98 and NT/2000 (only myodbc.dll and myodbc2.dll)
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-dll.zip
Source for MyODBC 2.50.39 for Windows95/98 or NT/2000
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-src.zip
==============================================================================
也可以采用 OLE DB 方式连接 MySQL,可在下面页面下载 MyOLEDB ,并安装:
(含大量 VB + ADO + OLE DB + MySQL 例程)
http://210.77.60.218/mirror/mysql/downloads/os-win32.html
MyOLEDB.chm (468K, modified: 2001/01/30)
http://210.77.60.218/mirror/mysql/Downloads/Win32/MyOLEDB.chm
MyOLEDB.exe (4.6M, modified: 2001/01/29)
http://210.77.60.218/mirror/mysql/Downloads/Win32/MyOLEDB.exe
Myoledb.zip (278K, modified: 2001/01/29)
http://210.77.60.218/mirror/mysql/Downloads/Win32/Myoledb.zip
MySamples.zip (604K, modified: 2001/01/29)
http://210.77.60.218/mirror/mysql/Downloads/Win32/MySamples.zip
'代码样例:
Dim adoConnection As New adodb.Connection
'ODBC + OLE DB 方式
'adoConnection.Open "Provider=MSDASQL.1;Driver={MySQL};host=localhost;DataBase=test;User ID=monty"
'OLE DB 方式 (强烈建议)
adoConnection.Open "Provider=MySqlProv.2.5;data source=test;User ID=monthy;server=yuer"
Dim adoRecordset As New adodb.Recordset
'adoRecordset.CursorLocation = adUseClient 'ODBC + OLE DB 方式必须有此句,方能用 DataGrid 显示
adoRecordset.Open "SELECT * FROM sample2", adoConnection ', adOpenKeyset
If Not adoRecordset.EOF Then
Debug.Print adoRecordset.GetString
End If
Set DataGrid1.DataSource = adoRecordset
回答:
1 楼ipman(.NET)回复于 2001-11-06 19:17:19 得分 0
socket编程Top
2 楼playyuer(退休干部 卧鼠藏虫)回复于 2001-11-06 19:34:39 得分 0
应该可以!1.首先,确认 MySQL 装在 Linux 正确无误!
(确切地说与 MySQL 的服务器端的操作系统无关,总之客户端既然是 VB,那就必然是 Windows 系列)
2.VB 中可以采用 ODBC + OLE DB 方式连接 MySQL,可在下面页面下载 MyODBC,并安装:
http://210.77.60.218/mirror/mysql/downloads/api-myodbc.html
MyODBC 2.50.39 for Windows95/98 (full setup)
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-win95.zip
MyODBC 2.50.39 for NT/2000 (full setup)
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-nt.zip
MyODBC 2.50.39 Windows95/98 and NT/2000 (only myodbc.dll and myodbc2.dll)
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-dll.zip
Source for MyODBC 2.50.39 for Windows95/98 or NT/2000
http://210.77.60.218/mirror/mysql/Downloads/MyODBC/myodbc-2.50.39-src.zip
==============================================================================
也可以采用 OLE DB 方式连接 MySQL,可在下面页面下载 MyOLEDB ,并安装:
(含大量 VB + ADO + OLE DB + MySQL 例程)
http://210.77.60.218/mirror/mysql/downloads/os-win32.html
MyOLEDB.chm (468K, modified: 2001/01/30)
http://210.77.60.218/mirror/mysql/Downloads/Win32/MyOLEDB.chm
MyOLEDB.exe (4.6M, modified: 2001/01/29)
http://210.77.60.218/mirror/mysql/Downloads/Win32/MyOLEDB.exe
Myoledb.zip (278K, modified: 2001/01/29)
http://210.77.60.218/mirror/mysql/Downloads/Win32/Myoledb.zip
MySamples.zip (604K, modified: 2001/01/29)
http://210.77.60.218/mirror/mysql/Downloads/Win32/MySamples.zip
'代码样例:
Dim adoConnection As New adodb.Connection
'ODBC + OLE DB 方式
'adoConnection.Open "Provider=MSDASQL.1;Driver={MySQL};host=localhost;DataBase=test;User ID=monty"
'OLE DB 方式 (强烈建议)
adoConnection.Open "Provider=MySqlProv.2.5;data source=test;User ID=monthy;server=yuer"
Dim adoRecordset As New adodb.Recordset
'adoRecordset.CursorLocation = adUseClient 'ODBC + OLE DB 方式必须有此句,方能用 DataGrid 显示
adoRecordset.Open "SELECT * FROM sample2", adoConnection ', adOpenKeyset
If Not adoRecordset.EOF Then
Debug.Print adoRecordset.GetString
End If
Set DataGrid1.DataSource = adoRecordset