Hi,
I have created database on absolut.x10hosting.com (IP 115.96.178.41) with database name ml123me_test.
After that i uploaded my project files to the CPanel. Following is the code
Default.aspx
<%@ Page Language="C#"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="MySql.Data.MySqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server">
private void Page_Load(Object sender, EventArgs e)
{
string connectionString = "server=absolut.x10hosting.com;Database=ml123me_test;userid=ml123me;password=******;Pooling=false;";
MySqlConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM emp", dbcon);
DataSet ds = new DataSet();
adapter.Fill(ds, "emp");
dbcon.Close();
dbcon = null;
GridView1.DataSource = ds.Tables["emp"];
GridView1.DataBind();
}
</script>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server"></asp:GridView>
</form>
</body>
</html>
It gives as error as follows :
System.Net.Sockets.SocketException: Connection refused
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remote_end) [0x00000]
at System.Net.Sockets.Socket+Worker.Connect () [0x00000]
If i change the server to the IP address 115.96.178.41
It gives error as follows :
MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts.
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000]
at MySql.Data.MySqlClient.Driver.Open () [0x00000]
at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000]
at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000]
Please help me on this topic.
Thanks in advance.
I have created database on absolut.x10hosting.com (IP 115.96.178.41) with database name ml123me_test.
After that i uploaded my project files to the CPanel. Following is the code
Default.aspx
<%@ Page Language="C#"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="MySql.Data.MySqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server">
private void Page_Load(Object sender, EventArgs e)
{
string connectionString = "server=absolut.x10hosting.com;Database=ml123me_test;userid=ml123me;password=******;Pooling=false;";
MySqlConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();
MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM emp", dbcon);
DataSet ds = new DataSet();
adapter.Fill(ds, "emp");
dbcon.Close();
dbcon = null;
GridView1.DataSource = ds.Tables["emp"];
GridView1.DataBind();
}
</script>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server"></asp:GridView>
</form>
</body>
</html>
It gives as error as follows :
System.Net.Sockets.SocketException: Connection refused
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remote_end) [0x00000]
at System.Net.Sockets.Socket+Worker.Connect () [0x00000]
If i change the server to the IP address 115.96.178.41
It gives error as follows :
MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts.
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000]
at MySql.Data.MySqlClient.Driver.Open () [0x00000]
at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000]
at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000]
Please help me on this topic.
Thanks in advance.
Last edited: