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

namespace InsertFromClient
{
  class Program
  {
    static void Main(string[] args)
    {
      // Code to insert data from client
      //   See chapter 14 for an implementation of 
      //   the GetConnectionStringFromConfigFile method.
      string connStr = GetConnectionStringFromConfigFile();

      SqlConnection conn = new SqlConnection(connStr);
      conn.Open();
      SqlCommand cmd = conn.CreateCommand();
      cmd.CommandText = "insert into test values ('testdata')";
      int rows_affected = cmd.ExecuteNonQuery();
      cmd.Dispose();
      conn.Dispose();
    }

    static string GetConnectionStringFromConfigFile()
    {
      // for now, just return the string
      return "server=.;integrated security=sspi;database=test";
    }
  }
}
