In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to operate the MySql database in .net. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Before you can use this class library, you must install
ODBC MYSQL 3.51 address:
Driver ODBC.NET download address: x?FamilyId=6CCD8427-1017-4F33-A062-D165078E32B1&displaylang=en "> http://www.microsoft.com/downloads/details.aspx?FamilyId=6CCD8427-1017-4F33-A062-D165078E32B1&displaylang=en
There are three classes in this library:
ManipStringForMySQL: this kind of string that modifies SGBD
MySQL_Requettes: send request
MySQL_Utils: testing SGBD data
Here is an example of using this type of library to manipulate MySql
/ / A pair of DataSet operations
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
/ / A call to a pair of functions
Dim MonDatasetTemp As DataSet = MySQL_Requettes.MyODBCDataset (
SQL
Constantes.ODBCBase
Constantes.ODBCServer
Constantes.ODBCPwd
Constantes.ODBCUser
"MonDataset")
After reading the above, do you have any further understanding of how to operate the MySql database in .net? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.