一定需要SqlCommandBuilder(sda)
SqlDataAdapter sda = new SqlDataAdapter("select * from Student", conn);
SqlCommandBuilder scb = new SqlCommandBuilder(sda);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
DataRow dr = ds.Tables[0].NewRow();
dr["id"] = 2013;
dr["name"] = "刘念";
dr["course"] = "高等数学";
dr["score"] = 100;
ds.Tables[0].Rows.Add(dr);
sda.Update(ds);
ds.AcceptChanges();
Txt文件从c#上传到数据库
_2018DB db = new _2018DB();
string path = "D:/code/2017 研究生复试/patient.txt";
StreamReader sr = new StreamReader(path,Encoding.UTF8);
string line = "";
while (sr.Peek() != -1)
{
line =