Tails07
New Member
- Messages
- 8
- Reaction score
- 0
- Points
- 0
I have been trying to set up a simple ASP.NET page with a connection to a MySQL database but I can't get it to work. I have been following the example from this post:
http://x10hosting.com/forums/tutorials/102062-how-get-asp-net-work-x10hosting.html
And here is my web.config:
And my page Mysql.aspx:
The page url is: http://zephyr.x10hosting.com/Mysql.aspx
Error message is:
Can anyone help me get this connection working?
http://x10hosting.com/forums/tutorials/102062-how-get-asp-net-work-x10hosting.html
And here is my web.config:
Code:
<?xml version="1.0" ?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation>
<assemblies>
<add assembly="MySql.Web"/>
<add assembly="MySql.Data"/>
</assemblies>
</compilation>
</system.web>
</configuration>
Code:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="MySql.Data.MySqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>MySQL Testing</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script runat="server">
private void Page_Load(Object sender, EventArgs e)
{
string connectionString = "server=localhost;Database=tails07_test;userid=tails07_admin;password=notlistedforsecurityreasons;Pooling= false;";
MySqlConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM table1", dbcon);
DataSet ds = new DataSet();
adapter.Fill(ds, "table1");
dbcon.Close();
dbcon = null;
ArtistsControl.DataSource = ds.Tables["table1"];
ArtistsControl.DataBind();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h1>Artists</h1>
<asp:DataGrid runat="server" id="ArtistsControl" />
</form>
</body>
</html>
Error message is:
Code:
[B][I]Exception of type 'System.Exception' was thrown.[/I][/B]
[B]Description: [/B]HTTP 500. Error processing request.
[B]Stack Trace: [/B]
System.Exception: Exception of type 'System.Exception' was thrown.
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0
Can anyone help me get this connection working?