. NET operation of MySQL database

Source: Internet
Author: User
This is a class library written in vb.net for the connection to MySQL. You can use this class library to manipulate MySQL database directly.

Before you use this class library, you must install
ODBC MYSQL 3.51 Download Address: http://www.mysql.com/downloads/api-myodbc-3.51.html
Driver ODBC. NET Download Address: http://www.microsoft.com/downloads/details.aspx?FamilyId=6CCD8427-1017-4F33-A062-D165078E32B1&displaylang=en

There are three classes in this library:
Manipstringformysql: This class modifies the SGBD string
Mysql_requettes: Send Request
Mysql_utils: Testing the SGBD data

Here is an example of using this class library to operate MySQL

Working with a dataset

Public Shared Function Myodbcdataset (ByVal reqsql As String, _
ByVal labase As String, ByVal Server as String, _< br> ByVal Password As String, ByVal User As String, _
ByVal Nomdataset As String) as DataSet
' Connexionàun serv Er 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 _
&";D atabase= "& 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

A call to a function

Dim mondatasettemp as DataSet = Mysql_requettes.myodbcdataset (
Sql
Constantes. Odbcbase,
Constantes. Odbcserver,
Constantes. Odbcpwd,
Constantes. Odbcuser,
"Mondataset")

The above is. NET operations MySQL database content more related articles please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.