Jump to content

Recommended Posts

Posted

Sorry for the delay in getting this posted. This is my test file that connects to MySql from .aspx and it works fine for me.

 

Default.aspx:

<%@ Page Language="VB" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">

Sub Page_Load(sender As Object, e As EventArgs)

   Dim myConnection  As MySqlConnection
   Dim myDataAdapter As MySqlDataAdapter
   Dim myDataSet     As DataSet

   Dim strSQL        As String
   Dim iRecordCount  As Integer

   myConnection = New MySqlConnection("server=johnny.heliohost.org; user id=username_database;
       password=********; database=username_database; pooling=false;")

   strSQL = "SELECT * FROM username_database.people;"

   myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
   myDataSet = New Dataset()
   myDataAdapter.Fill(myDataSet, "people")

   MySQLDataGrid.DataSource = myDataSet
   MySQLDataGrid.DataBind()

End Sub

</script>

<!DOCTYPE html>
<html lang="en">
   <head>
       <meta charset="utf-8" />
       <title>ASP.NET MySQL Test</title>
   </head>
   <body>
       <div>
           <form runat="server">

<asp:DataGrid id="MySQLDataGrid" runat="server" />

           </form>
       </div>
   </body>
</html>

 

web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation>
<assemblies>
<add assembly="*"/>
</assemblies>
</compilation>

</system.web>
</configuration>

 

MySql.Data.dll:

http://area51.heliohost.org/MySql.Data.dll.gz

 

Test database:

mysql> select * from people;
+----+------------+-----------+
| id | first_name | last_name |
+----+------------+-----------+
|  1 | Jack       | Spratt    |
|  2 | Jill       | McHill    |
|  3 | Joe        | Schmoe    |
+----+------------+-----------+
3 rows in set (0.02 sec)

Guest
This topic is now closed to further replies.
×
×
  • Create New...