Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- SqlConnection con = new SqlConnection();
- con.ConnectionString = "Data Source=LEGEND-DG31PR\\usmansql;Initial Catalog=Biztek;Integrated Security=True";
- con.Open();
- SqlCommand com = new SqlCommand();
- com.CommandType = CommandType.StoredProcedure;
- com.CommandText = "sp_LoginUser";
- com.Connection = con;
- com.Parameters.Add(new SqlParameter("@username", TextBox1.Text));
- com.Parameters.Add(new SqlParameter("@pass", TextBox2.Text));
- SqlDataAdapter adp = new SqlDataAdapter();
- adp.SelectCommand = com;
- DataSet ds = new DataSet();
- adp.Fill(ds);
- if (ds.Tables[0].Rows.Count > 0)
- {
- GridView1.DataSource = ds.Tables[0];
- GridView1.DataBind();
- }
- }
- catch
- {
- Label3.Text = "Try Again";
- }
Add Comment
Please, Sign In to add comment