Click here to Skip to main content
14,664,450 members
Rate this:
Please Sign up or sign in to vote.
See more:
how to design a form using textboxes and labels to retrieve table data from sqlserver
Posted
Comments
bbirajdar 17-Apr-12 10:33am
   
Homework..

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
amperayani 17-Apr-12 10:37am
   
i need to write database connection in app.config , is this same
Reza Ahmadi 17-Apr-12 10:43am
   
Replace this line:
SqlConnection connection = new SqlConnection("YOUR CONNECTION STRING HERE");
With this one:
string connectionStr = ConfigurationManager.ConnectionStrings["YourConnectionNameInConfigFile"].ConnectionString;
SqlConnection connection = new SqlConnection(connectionStr);
Rate this:
Please Sign up or sign in to vote.

Solution 2

just drag and drop the labels and textboxes on the form and giving the name properly.

in the code behind file you just give the value as

for example;
you have label on the form name lblName you can bind this...


lblname.text = dt.rows[0]["Name"].tostring();

same procedure is apply on the textboxes ...
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100