Home > Interview Questions > ADO.NET > How to fill dataset using DataAdapter using ADO.NET?

How to fill dataset using DataAdapter using ADO.NET?

by Spidy   on 18/05/2011   Category: ADO.NET   |  Level: Beginner   |  Views: 1501    |  Points: 25     |  Silver 


sample code snippet for loading dataset using DataAdapter fille method.


Namespaces


using System;
using System.Data;
using System.Data.SqlClient;


try
{
using (SqlConnection objConn = new SqlConnection("....."))
{
SqlDataAdapter objAd = new SqlDataAdapter("Select * from Employees", objConn);
DataSet objDS = new DataSet();
objAd.Fill(objDS);
}
}
catch(Exception ex)
{
throw ex;
}



« How do you handle exceptions in the asp.net web form using error events?
» What is the use of DataAdapter.Fill() in ADO.NET?
Post Question  |  Question Home

Recent Posts

User Responses


No response found, be the first to review this question.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts