using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Data; namespace ElementaryDbExample { class Program { static void Main(string[] args) { try { SqlConnection conn = new SqlConnection(); conn.ConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=AdventureWorks;User Id=sa;Password=v044728V;"; conn.Open(); SqlCommand cmd1 = conn.CreateCommand(); //RETURNING NO VALUE SqlParameter p = new SqlParameter("@par1", SqlDbType.VarChar); p.Value = "Kim"; cmd1.Parameters.Add(p); cmd1.CommandType = System.Data.CommandType.Text; cmd1.CommandText = "UPDATE Person.Contact SET FirstName = 'Kam' WHERE FirstName = @par1"; int rows = cmd1.ExecuteNonQuery(); Console.WriteLine("number of changed rows: " + rows); conn.Close(); } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } Console.ReadKey(); } } }