asp.net如何连接MySQL
录入时间:2008-07-17 15:14
类别:电脑常识
共享:否
问:
请问asp.net如何连接MySQL?
另外asp.net如何连接远程的MySQL?
谢谢
______________________________________________________________________________________________
答1:
http://www.mysql.com/products/myodbc/manual.html#ODBC.NET(C#)
或
http://www.csdn.net/Develop/read_article.asp?id=16437
.NET中各种数据库连接大全
______________________________________________________________________________________________
答2:
oConn.Open "Provider=MySQLProv;" & _
"Data Source=mySQLDB;" & _
"User Id=myUsername;" & _
"Password=myPassword"
______________________________________________________________________________________________
答3:
下载一个mysql的ODBC就行了,这个ODBC在mysql网站上有。
______________________________________________________________________________________________
答4:
Sub Page_Load(Src As Object, E As EventArgs)
Dim myConnection As SqlConnection
myConnection = New SqlConnection("server=localhost;" _
& "database=数据库;USER ID=sa;PWD=")
Dim myCommand As SqlDataAdapter = New SqlDataAdapter("SELECT *" _
& " FROM 表", myConnection)
Dim ds As DataSet = New DataSet()
myCommand.Fill(ds)
Dim view As DataView = ds.Tables(0).DefaultView
view.Sort = sortField & " ASC"
MyDataGrid.DataSource = view
MyDataGrid.DataBind()
End Sub
Sorting Data in a DataGrid Control
attributes. --%>
OnSortCommand="MyDataGrid_Sort"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AllowSorting="true"
/>