這是在VB
在使用這個類庫之前
ODBC MYSQL
Driver ODBC
在這個庫中有三個類
ManipStringForMySQL: 此類修改SGBD的字符串
MySQL_Requettes: 發送請求
MySQL_Utils : 對SGBD數據進行測試
下面是使用此類庫操作MySql的一個例子
//對DataSet進行操作
Public Shared Function MyODBCDataset(ByVal ReqSQL As String
ByVal LaBase As String
ByVal Password As String
ByVal NomDataSet As String) As DataSet
Dim MyConString As String = _
"DRIVER={MySQL ODBC
& ";DATABASE=" & LaBase & ";UID=" & User _
& ";PASSWORD=" & Password & ";OPTION=
Dim MyODBCConnexion As New OdbcConnection(MyConString)
Try
Dim ds As New DataSet()
Dim cmd As OdbcDataAdapter = New
OdbcDataAdapter(ReqSQL
Dim MyCommand As New OdbcCommand()
Dim MyDataReader As OdbcDataReader
cmd
MyODBCConnexion
Return ds
Catch MyOdbcException As OdbcException
HttpContext
Catch MyException As Exception
HttpContext
End Try
End Function
//對函數的調用
Dim MonDatasetTemp As DataSet = MySQL_Requettes
SQL
constantes
constantes
constantes
constantes
"MonDataset")
此程序用到的類庫可在如下地址下載
From:http://tw.wingwit.com/Article/program/net/201311/14124.html