问题描述
- 添加一行数据,insertinto 语法错误
-
string connstr = "Provider=Microsoft.Jet.OleDb.4.0;";
connstr += @"Data Source=D:Merger201503016caohuanGEARCNC.mdb";//创建连接对象OleDbConnection tempconn = new OleDbConnection(connstr); OleDbDataAdapter WorkPieceDataDA = new OleDbDataAdapter("select * from WorkPieceData", tempconn); OleDbCommandBuilder builder = new OleDbCommandBuilder(WorkPieceDataDA); DataSet ds = new DataSet(); WorkPieceDataDA.Fill(ds, "WorkPieceData"); //新建一行 DataRow dr = ds.Tables["WorkPieceData"].NewRow(); //为各字段赋值 dr["齿数"]=ChiShu.Text; dr["法面模数"] = BiaoZhunMoShu.Text; ds.Tables["WorkPieceData"].Rows.Add(dr); // OleDbCommandBuilder builder = new OleDbCommandBuilder(WorkPieceDataDA); WorkPieceDataDA.Update(ds, "WorkPieceData");//报错insert into语句错误
解决方案
tempconn 没打开啊
时间: 2024-09-30 05:34:59