new SqlDataAdapter
using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
class MainClass
{
static void Main(string[] args)
{
SqlConnection SConn = new SqlConnection("Data Source=(local); Initial Catalog = CaseManager; Integrated Security=true");
SqlDataAdapter da = new SqlDataAdapter("SELECT ID, FirstName, LastName FROM Employee", SConn);
DataSet ds = new DataSet();
DataTableMapping custMap = da.TableMappings.Add("Employee", "MyDatabase");
custMap.ColumnMappings.Add("ID", "Number");
custMap.ColumnMappings.Add("FirstName", "first name");
custMap.ColumnMappings.Add("LastName", "last name");
da.Fill(ds);
}
}
Related examples in the same category