All pastes #284757 Raw Edit

Nagappan

public text v1 · immutable
#284757 ·published 2006-12-19 07:37 UTC
rendered paste body
		[Test]
		/**
		   The below test will not run everytime, since the region id column is unique
		   so change the regionid if you want the test to pass.
		**/	
		public void UpdateTest () {
			conn = (SqlConnection) ConnectionManager.Singleton.Connection;
			try {
				ConnectionManager.Singleton.OpenConnection ();
				DataTable dt = new DataTable();
				SqlDataAdapter da = null;
				Console.WriteLine ("UpdateTest start");
				da = new SqlDataAdapter("Select * from employee", conn);
				//SqlCommandBuilder cb = new SqlCommandBuilder (da);
				da.Fill(dt);
				DataRow dr = dt.NewRow();
				dr ["id"] = 6002;
				dr ["fname"] = "boston";
				dr ["dob"] = DateTime.Now.Subtract (new TimeSpan (20*365, 0, 0, 0));
				dr ["doj"] = DateTime.Now;
				dt.Rows.Add(dr);

				da.Update(dt);
			} finally {
				Console.WriteLine ("UpdateTest end");
				DBHelper.ExecuteSimpleSP (conn, "sp_clean_employee_table");
				ConnectionManager.Singleton.CloseConnection ();
			}
		}