Data Access Objcet In ASP.NET

ADO.NET provides its objects, properties, and methods through the three namespaces described in Table 5-1. The System.Data.SqlClient, System.Data.Oracle­Client, and System.Data.OleDb namespaces listed in the table provide equivalent features for Microsoft SQL Server and other databases, respectively.



// (1) Create the DataBase connection.
SqlConnection Conn = new SqlConnection("server=(local);" +
"database=Employee;Trusted_Connection=yes");
// (2) Create a Data Adapter.
DA = new SqlDataAdapter("select * from Contacts",
Conn);
// (3) Create a Dataset.
DataSet ds = new DataSet();
// (4) Fill the data set.
DA.Fill(ds, "Employee");
// (5) Display Records in data grid using data binding.
DataGrid1.DataSource = ds.Tables["Employee"].DefaultView;
DataGrid1.DataBind();



For futher information, open "http://dotnetheavens.blogspot.com/"

Thanks
-Nimesh.

Reference: http://dotnetheavens.blogspot.com/


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: