Using Data Table Mappings : Update « Database « C# / C Sharp

Using Data Table Mappings

 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email:
 * Create Date: June 27, 2003
 * Last Modified Date:
 * Version: 1
using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;

namespace Client.Chapter_13___ADO.NET
    public class UsingDataTableMappings
        static void Main(string[] args)
            SqlConnection SConn = new SqlConnection("Data Source=(local); Initial Catalog = CaseManager; Integrated Security=true");
            SqlDataAdapter da = new SqlDataAdapter("SELECT ID, Contact, Email FROM CaseInfo", SConn);
            DataSet ds = new DataSet();
            DataTableMapping custMap = da.TableMappings.Add("CaseInfo", "MyDatabase");
            custMap.ColumnMappings.Add("ID", "CaseNumber");
            custMap.ColumnMappings.Add("Contact", "MyContact");
            custMap.ColumnMappings.Add("Email", "Email Address");

Related examples in the same category

1.Use DataTable to update table in Database
2.Update table using SqlDataAdapter
3.Illustrates how to perform INSERT, UPDATE, and DELETE statements using ADO.NET
4.Creating Data Tables and Populating Them
5.Update A DataSource
6.Update Data Using Commond Builder
7.Update Data Using Sql Statements 2