Hi All
Could you tell me if it is possible to get aspx pages talking to mysql on x10 hosting?
I have looked through the forums and someone seems to be suggesting adding MySql.Data.dll to a directory called bin and adding the reference to the web.config file. I have tried this and I get the following error.
System.Exception: Exception of type 'System.Exception' was thrown.
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000]
Here is my aspx code
<%@ Page Language="C#" %>
<%@ 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>CD cat</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=my_database;User ID=mysuerid;Password=mypassword;Pooling=false;";
MySqlConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM artists", dbcon);
DataSet ds = new DataSet();
adapter.Fill(ds, "result");
dbcon.Close();
dbcon = null;
ArtistsControl.DataSource = ds.Tables["result"];
ArtistsControl.DataBind();
}
</script>
</head>
<body>
<h1>Artists</h1>
<aspataGrid runat="server" id="ArtistsControl" />
</body>
</html>
Thanks
SPangeman
Could you tell me if it is possible to get aspx pages talking to mysql on x10 hosting?
I have looked through the forums and someone seems to be suggesting adding MySql.Data.dll to a directory called bin and adding the reference to the web.config file. I have tried this and I get the following error.
System.Exception: Exception of type 'System.Exception' was thrown.
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000]
Here is my aspx code
<%@ Page Language="C#" %>
<%@ 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>CD cat</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=my_database;User ID=mysuerid;Password=mypassword;Pooling=false;";
MySqlConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM artists", dbcon);
DataSet ds = new DataSet();
adapter.Fill(ds, "result");
dbcon.Close();
dbcon = null;
ArtistsControl.DataSource = ds.Tables["result"];
ArtistsControl.DataBind();
}
</script>
</head>
<body>
<h1>Artists</h1>
<aspataGrid runat="server" id="ArtistsControl" />
</body>
</html>
Thanks
SPangeman