Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to bind dataset value to textbox in c# (or) how to assign value from dataset to dataset in c# asp.net

This post shows how to assign Dataset values into Textboxes or labels , how to get row value from dataset in c#,   Get a single value from dataSet in asp.net



 protected void btnsearch_Click(objectsender, EventArgs e)
        {
            if(Label2.Text != "" && Session["username"].ToString() != "")
            {
                 stringun = Convert.ToString(Session["username"]);
                stringnameproof ="select * from UserRegistration where UEmail = '"+ un +"'";

// here con is your connection string

                SqlDataAdapterad = new SqlDataAdapter(nameproof,con);
                DataSetds = new DataSet();
                ad.Fill(ds);
                if(ds.Tables[0].Rows.Count > 0)
                {
                    stringuname = ds.Tables[0].Rows[0]["UName"].ToString();
                    stringproof1 = ds.Tables[0].Rows[0]["UIdproof"].ToString();
                    stringproof2 = ds.Tables[0].Rows[0]["UIdnumber"].ToString();
                    stringproof = proof1 + proof2;
                   
                }
            }
        }




This post first appeared on Asp.netSourceCodes, please read the originial post: here

Share the post

How to bind dataset value to textbox in c# (or) how to assign value from dataset to dataset in c# asp.net

×

Subscribe to Asp.netsourcecodes

Get updates delivered right to your inbox!

Thank you for your subscription

×