Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai all,i write this code use verification againest database
C#
            cmd.CommandText = "SP_user_verifi";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Name", nameforlogin.Text);
            cmd.Parameters.AddWithValue("@Password", pwdforlogin.Text);


            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();
            da.SelectCommand = cmd;
            da.Fill(ds);


            if (ds != null && ds.Tables.Count > 0)
            {
                string status = ds.Tables[0].Rows[0][0].ToString();
                if (status == "yes")
               
                //    Session["nameforlogin"] = ds.Tables[1].Rows[0]["Name"].ToString();
                //    Session["pwdforlogin"] = ds.Tables[1].Rows[0]["Password"].ToString();



                Session["name"]          =  nameforlogin.Text;
                Session["password"]      = pwdforlogin.Text;
                Response.Redirect("home.aspx");

                }
                else
                {
                    Response.Redirect("somepage.aspx");


and this is for getting user record by his name


            if (Session["name"] != null)
            {

                string name = Session["Name"].ToString();
                SqlConnection conn = new SqlConnection("Data Source=USER-PC\\ADITYA;Initial Catalog=holder;Persist Security Info=True;User ID=sa;Password=123");
                conn.Open();

                SqlCommand cmd = new SqlCommand("select * from tb_userlogin where Name =@Name", conn);
                cmd.Parameters.AddWithValue("@Name", name);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                da.Fill(dt);
            }
            else
            {
                Response.Redirect("test1.aspx");

            }

now i need to get the record using user's id,how can i get this

Thanks and Regards
Posted
Updated 16-Sep-13 0:31am
v2
Comments
JoCodes 16-Sep-13 9:09am    
Whats the problem you are facing exactly here?
Mahesh_Bhosale 17-Sep-13 5:22am    
can't understand your problem...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900