This time I use ado.net to insert a piece of data into the database. The master uses the stored procedure. I do not want to be in the form of SQL text every time, so never progress ~ ~ ~
Then you select the script you just executed, create a good database, and then use the data below to add data to the database table
Insert into MyClass (C_ID,C_NAME,C_DESCR) VALUES (1, ' Software class 1108 ', ' Wuhan Software Engineering Vocational College ');
Insert into MyClass (C_ID,C_NAME,C_DESCR) VALUES (2, ' software class 1107 ', ' Wuhan Software Engineering Vocational College ');
Insert into MyClass (C_ID,C_NAME,C_DESCR) VALUES (3, ' Experimental class ', ' Wuhan Software Engineering Vocational College '); Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 1 ', ' dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 2 ', ' Dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 3 ', ' Dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 4 ', ' Dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert INTO Mystudent (s_id,s_name,s_gender,s_age,s_birthday,s_cardid,s_phone,s_address,s_CID) VALUES (' 5 ', ' Dick ', ' Men ', ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1); Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 6 ', ' Dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 7 ', ' Dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 8 ', ' Dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 9 ', ' Dick ', ' male ')
, ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 10 ', ' Dick ', '
Male ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert INTO Mystudent (S_id,s_name,s_gender,s_age,s_birthDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 11 ', ' Dick ', ' Men ', ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan
', 1); Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 12 ', ' Dick ', '
Male ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 13 ', ' Dick ', '
Male ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 14 ', ' Dick ', '
Male ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 15 ', ' Dick ', '
Male ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; Insert into mystudent (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 16 ', ' Dick ', '
Male ', ', ' 1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1; INSERT INTO MystudENT (S_ID,S_NAME,S_GENDER,S_AGE,S_BIRTHDAY,S_CARDID,S_PHONE,S_ADDRESS,S_CID) VALUES (' 17 ', ' Dick ', ' Male ', ' 22 ', '
1992-09-26 ', ' 111111111 ', ' 11232131234 ', N ' Shenzhen Bao Baoan ', 1;
Explain, wait. I'm going to insert data into the MyClass table and now create an inserted stored procedure for this table:
I was reviewing, ado.net, now casually built a console application to start my test:
Note that in the following example, in order to be as simple and easy to understand as possible, I did not put that part of the connection string into the configuration file.
If you want to put it, use the System.Configuration namespace, and a ConfigurationManager class. The details will not be said.
The above mentioned is the entire content of this article, I hope you can enjoy.