在使用这个类库之前,你必须安装
在这个库中有三个类:
ManipStringForMysqL: 此类修改SGBD的字符串
MysqL_Requettes: 发送请求
MysqL_Utils : 对SGBD数据进行测试
下面是使用此类库操作MysqL的一个例子
//对DataSet进行操作
Public Shared Function MyODBCDataset(ByVal Reqsql As String,_
ByVal LaBase As String,ByVal Server As String,_
ByVal Password As String,ByVal User As String,_
ByVal NomDataSet As String) As DataSet
' Connexion à un server MysqL
'avec le Driver ODBC 3.51 avec requette qui renvoie un dataset
Dim MyConString As String = _
"DRIVER={MysqL ODBC 3.51 Driver};SERVER=" & Server _
& ";DATABASE=" & LaBase & ";UID=" & User _
& ";PASSWORD=" & Password & ";OPTION=3;"
Dim MyODBCConnexion As New OdbcConnection(MyConString)
Try
Dim ds As New DataSet()
Dim cmd As OdbcDataAdapter = New
OdbcDataAdapter(Reqsql,MyConString)
Dim MyCommand As New OdbcCommand()
Dim MyDataReader As OdbcDataReader
cmd.Fill(ds,NomDataSet)
MyODBCConnexion.Close()
Return ds
Catch MyOdbcException As OdbcException
'
HttpContext.Current.Response.Write(MyOdbcException.ToString)
Catch MyException As Exception
'
HttpContext.Current.Response.Write(MyException.ToString)
End Try
End Function