這次我使用ADO.NET來(lái)插入一條數(shù)據(jù),到數(shù)據(jù)庫(kù)中。主用到存儲(chǔ)過(guò)程。我不想每次都是用SQL文本的形式了,那樣始終沒(méi)有進(jìn)步~~~
接著大家選中剛才執(zhí)行腳本,創(chuàng)建好的數(shù)據(jù)庫(kù),然后使用我下面的數(shù)據(jù),向數(shù)據(jù)庫(kù)表里面添加數(shù)據(jù)吧
insert into MyClass(C_ID,C_Name,C_Descr)values(1,'軟件1108班','武漢軟件工程職業(yè)學(xué)院');
insert into MyClass(C_ID,C_Name,C_Descr)values(2,'軟件1107班','武漢軟件工程職業(yè)學(xué)院');
insert into MyClass(C_ID,C_Name,C_Descr)values(3,'實(shí)驗(yàn)班','武漢軟件工程職業(yè)學(xué)院');
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('1','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('2','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('3','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('4','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('5','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('6','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('7','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('8','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('9','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('10','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('11','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('12','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('13','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('14','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('15','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('16','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
insert into MyStudent(S_ID,S_Name,S_Gender,S_Age,S_Birthday,S_CardID,S_Phone,S_Address,S_CID)values('17','李四','男','22','1992-09-26','111111111','11232131234',N'深圳寶安石巖',1);
說(shuō)明一下,等會(huì)我要向MyClass表中插入數(shù)據(jù),現(xiàn)在為這個(gè)表創(chuàng)建一個(gè)插入的存儲(chǔ)過(guò)程:
我是復(fù)習(xí),ADO.NET,現(xiàn)在就隨便建了一個(gè)控制臺(tái)的應(yīng)用程序,來(lái)開(kāi)始我的測(cè)試:
如果要放的話,要用到System.Configuration命名空間,還有一個(gè)ConfigurationManager類..具體的細(xì)節(jié)就不說(shuō)了。