reset and begin
12/04/2010

khởi tạo kết nối tới SQL Server C#

khởi tạo kết nối tới SQL Server
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();

Bloger Comments
G+ Comments
Comments FaceBook

No comments:

List

Profiles Information


About me : Nothing is 1 vài thứ - 1985

Places I've Lived : I Hà Nội

Home Page : http://www.shimivn.blogspot.com/

Think : 1:1000000000

Languages spoken : Vietnamese,English.

Mobile : sony C2305

dell : i3-Ram 3GB- HDD 250GB .