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:
How to get ASP.Net to work at x10Hosting
And here is my web.config:
And my page Mysql.aspx: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>
The page url is: http://zephyr.x10hosting.com/Mysql.aspxCode:<%@ 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:
Can anyone help me get this connection working?Code:Exception of type 'System.Exception' was thrown. Description: HTTP 500. Error processing request. Stack Trace: System.Exception: Exception of type 'System.Exception' was thrown. at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0


LinkBack URL
About LinkBacks
Reply With Quote
(at bottom of my post )


