iam getting error can u tell me where did i wrong here

Posted by Chanti444 under ASP.NET on 12/27/2011 | Points: 10 | Views : 885 | Status : [Member] | Replies : 4
hi,
thsi is my error ..........******SQL Query failed: Host 'seetharam-NET' is not allowed to connect to this MySQL server **********
iam using below code for remote acess for mysql
using System.Data;
using MySql.Data.MySqlClient;
protected void Button1_Click(object sender, EventArgs e)
{


string strCon = "Data Source=192.168.1.32; User Id=;password=;database=chanti;Persist Security Info=True;PORT=3306";
MySqlConnection con = new MySqlConnection(strCon);

string strSQL = "SELECT * from empdetails";
MySqlCommand cmd = new MySqlCommand(strSQL,con);


try
{
con.Open();
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
con.Close();
}

catch (Exception ex)
{
Label1.Text = "SQL Query failed: " + ex.Message;
}

satya


Responses

Posted by: Ivlnr on: 12/27/2011 [Member] Starter | Points: 25

Up
0
Down
check the permission to this user to connect to database.

Chanti444, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: balajirnaukri-12656 on: 12/27/2011 [Member] Starter | Points: 25

Up
0
Down
I think so ur datasource credentials are not proper

Thanks and Regards
Balaji.R
ASP.NET Devloper
Solve-IT corp

Chanti444, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ogipansrk on: 12/28/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Satya,

Pls , check your connection string.

Regards,
ogipansrk

Chanti444, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 12/28/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
HI Chanti444

i think u check ur connection string . . . specially DataSource Tag

Best Regard's
Prabhakar

Chanti444, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response