問(wèn):
請(qǐng)問(wèn)asp.net如何連接MySQL,? 另外asp.net如何連接遠(yuǎn)程的MySQL,? 謝謝 ______________________________________________________________________________________________ 答1: http://www./products/myodbc/manual.html#ODBC.NET(C#) 或 http://www.csdn.net/Develop/read_article.asp?id=16437 .NET中各種數(shù)據(jù)庫(kù)連接大全 ______________________________________________________________________________________________ 答2: oConn.Open "Provider=MySQLProv;" & _ "Data Source=mySQLDB;" & _ "User Id=myUsername;" & _ "Password=myPassword" ______________________________________________________________________________________________ 答3: 下載一個(gè)mysql的ODBC就行了,,這個(gè)ODBC在mysql網(wǎng)站上有,。 ______________________________________________________________________________________________ 答4: <%@ Page Language="vb" Debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <html> <script language="VB" runat="server"> Sub Page_Load(Src As Object, E As EventArgs) Dim myConnection As SqlConnection myConnection = New SqlConnection("server=localhost;" _ & "database=數(shù)據(jù)庫(kù);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 </script> <body> <%-- Display the data in the body of the page. --%> <h3><font face="Verdana">Sorting Data in a DataGrid Control</font></h3> <%-- Within a form, create a DataGrid control and initialize its attributes. --%> <form runat="server"> <ASP:DataGrid id="MyDataGrid" runat="server" 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" /> </form> </body> </html> |
|