Click here to Skip to main content
15,914,642 members

Comments by tusharkaushik (Top 137 by date)

tusharkaushik 14-Jun-18 23:01pm View    
Sir i have modified code :
NOw this is my code :

protected void btnInput_Click(object sender, EventArgs e)
{
try
{
conn = new SqlConnection("Data Source=LENOVO;Initial Catalog=sample;User ID=sa;Password=***********");

Response.Write("connection to databaase is established");
string query = "select email_ID,pswd from LogIn where email_ID=@email_ID and pswd=@pswd";
cmd = new SqlCommand(query, conn);
cmd.Parameters.AddWithValue("@email_ID", txtuser.Text);
cmd.Parameters.AddWithValue("@pswd", txtpass.Text);
sda = new SqlDataAdapter(cmd);
dt = new DataTable();
sda.Fill(dt);
conn.Open();
if (dt.Rows.Count > 0)
{
Session["id"] = txtuser.Text;
Response.Redirect("welcome.aspx");
Session.RemoveAll();
}
else
{
lblmessage.Text = "Invalid username or password is incorrect";
lblmessage.ForeColor = System.Drawing.Color.Red;

}
}
catch(Exception ex)
{
Response.Write("connection problem \n" + ex.Message);
Response.Write("Source of exception is"+ ex.Source);

}

when i set my breakpoint on select query it shows that query is null
tusharkaushik 5-Jun-18 7:55am View    
but i have to sign in with credentials that are stored in the tblregister table in the sample database
tusharkaushik 5-Jun-18 2:27am View    
I have tried but result is still null
tusharkaushik 22-Jul-17 3:28am View    
yes
tusharkaushik 22-Jul-17 1:00am View    
how it can e possible