using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DataAdapterEx
{
  class Program
  {
    static void Main(string[] args)
    {
      // Instantiate a SqlDataAdapter 
      string connect_string = GetConnectStringFromConfigFile();

      SqlDataAdapter da = new SqlDataAdapter(
        "select * from authors", connect_string);

      // command builder for default update commands
      SqlCommandBuilder bld = new SqlCommandBuilder(da);
      DataSet ds = new DataSet();
      da.Fill(ds, "authors");

      // update the fifth row, third column
      ds.Tables[0].Rows[4][2] = "Bob";
      // use the default update commands
      da.Update(ds, "authors");

    }

    static string GetConnectStringFromConfigFile()
    {
      return "server=.;integrated security=sspi;database=pubs";
    }
  }
}
