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
Describe briefly what is the role of IIS on an ASP.NET application? What does it for the same application?
What is the difference between WindowsDefaultLocation and WindowsDefaultBounds?
What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?
Differentiate between client-side and server-side validations in web pages.
Which object encapsulates state or data of a user?
Which is an advantage of application service providers?
Why will you usually create an aspnet user account in the database for an asp.net web application?
Can you nest updatepanel within each other?
What is postback and autopostback in asp.net?
What do you mean by query string?
What is the use of session state and application state and difference between them?
What is a server farm in iis?
How to use multiple scriptmanager controls in a web page?
Give 2 examples for scenarios when routing is not applied?
while developing webservices if i want some users to use my webservice only how can i give security to my webservice?