Getting error - Login failed on server side
[B]Question asked by visitor papin[/b]
When i connect the database (on SQL server) by through of SQL Data Adapter and data set and finally fill the data set .. and run the programme ...in this time the error occurs - login failed on server side ...How it rectify please replay me..
Re: Getting error - Login failed on server side
Dear Friends,
You may user different connection string,
I thing you have to use DNS
Thanks,
Adarsh Patel
Re: Getting error - Login failed on server side
Hai,
Try the below coding for login .This is one sample.Here I tried when the “user name and password” in the login form and database is same then your “first name” which is in the database will display in one label(here you can display user login page).
[I]protected void Button1_Click(object sender, EventArgs e)
{
string nname, npassword;
nname = txtname.Text.ToString();
npassword = txtpass.Text.ToString();
//make a SQL connection
SqlConnection con = new SqlConnection("your connection String")
con.Open();
SqlCommand cmd = new SqlCommand("SELECT FirstName FROM login WHERE (Username='" + nname + "' AND password='" + npassword + "')", con);
DataTable dt = new DataTable();
SqlDataAdapter adptr = new SqlDataAdapter(cmd);
adptr.Fill(dt);
if (dt.Rows.Count > 0)
{
DataRow dr1 = dt.Rows[0];
Label1.Text = "Welcome";
Label2.Text = dr1["FirstName"].ToString();
}
else
Label2.Text = "Sorry,Invalid User name or password.........please try again";
con.Close();
[/I]
Regards,
Nithya.R