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
Can we handle the error and redirect to some pages using web.config?
What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc
About CLR, reflection and assemblies?
Explain how to prepare culture-specific formatting in .net.
What is session in http request?
Explain the difference between asp.net mvc and asp.net webforms? : asp.net mvc
How tooltip is set through code-behind in ASP.NET?
What are the Types of objects in ASP
In which situation can you not use a viewstate?
Define authentication and authorization.
What is application and session in asp.net?
How you will handle session when deploying application in more than a server?
Is react a template engine?
What is a nested masterpage in asp.net 2.0? Can there be a master page inside a masterpage?
What is redirectpermanent in asp.net?