ADO.Net - how to get data from database and bind to the
controls -- write this small code
Answer Posted / kinjal panchal
first of all write namespace in your page.
using Syste.data.sqlclient;
//code
sqlconnection cn=new sqlconnection();
cn.open();
sqlcommand cmm=new sqlcommand("write select query here",cn);
sqldataAdupter da=new sqldataAdupter(cmm);
datatable dt=new datatable();
da.fill(dt);
cn.close();
suppose u have gridview control then
gridview.datasource=dt;
gridview.databind();
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How is the asp.net mvc architecture different from others? : asp.net mvc
How does asp.net page work?
Which method has beenintroduced in asp.net 4.0 to redirect a page permanently?
What is caching? What are different ways of caching in asp.net?
What are themes and skins in 2.0, explain usage scenario?
What is server side session management?
What is the use of asp.net web api?
What is session mode in asp.net?
What is session authentication?
What is a master page and what does it do?
What are Master Pages in ASP.NET?
What is difference between mvc and asp.net? : Asp.Net MVC
How do I create a web form?
What is a nested masterpage in asp.net 2.0? Can there be a master page inside a masterpage?
What is asp.net mvc5? : Asp.Net MVC