SqlConnection sqlConn = new SqlConnection("Server=SQLDB;uid=sa;pwd=password;database=pubs");
Insert
SqlCommand insCom = new SqlCommand("INSERT INTO employee VALUES ('AR D4372','Andrew','P','Batter','61000876','1999-10-11T00:00:00')",sqlConn);
Update
SqlCommand updCom = new SqlCommand("UPDATE employee SET job_id=1 WHERE fname='Pedro'",sqlConn);
Delete
SqlCommand delCom = new SqlCommand("DELETE FROM employee WHERE fname='Andrew'",sqlConn); delCom.Connection.Open(); delCom.ExecuteNonQuery(); delCom.Connection.Close();
No comments: