Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
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..

 
Share this answer
 
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);
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 ...
 
Share this answer
 

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