new SqlDataAdapter : SqlDataAdapter « System.Data.SqlClient « C# / C Sharp by API






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

1.SqlDataAdapter.Fill
2.SqlDataAdapter.DeleteCommand
3.SqlDataAdapter.InsertCommand
4.SqlDataAdapter.RowUpdated
5.SqlDataAdapter.RowUpdating
6.SqlDataAdapter.SelectCommand
7.SqlDataAdapter.SelectCommand.Parameters.Add
8.SqlDataAdapter.TableMappings
9.SqlDataAdapter.TableMappings.Add
10.SqlDataAdapter.Update
11.SqlDataAdapter.UpdateCommand