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 can we apply themes to an asp.net application?
What is application variable in asp.net?
What is the difference between typeof() vs gettype()?
What is difference between URL and URI?
Explain the updatepanel?
What are the advantages of the code-behind feature?
Which is faster viewdata or viewbag?
If you are using two select queries and retrieving data. how do you access second query's result set using data reader?
If we remove web.config or machine.config from the application then, is this application will works?
Asp pages that worked pefectly on windows 2000 server and iis 5.0 do not work on windows 2003 server with iis 6.0. Asp.net pages work fine. Why?
List the types of authentication supported by asp.net?
What is marshalling ? Is it a part of asp.net ?
What are the different types of validation controls provided in ASP.NET?
What is the difference between ldap and active directory?
Why mvc is better than asp.net? : Asp.Net MVC