查询值的数目与目标字段中的数目不同
<P>private void Save_Click(object sender, EventArgs e)<BR> {<BR> try<BR> {<BR> //判断所有字段是否添完,添完则执行,反之弹出提示<BR> if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text!="")<BR> {<BR> string strConn = @" Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = D:\C#\Display Control\检测结果.mdb ";<BR> OleDbConnection myConn = new OleDbConnection(strConn);<BR> </P><P> //把Dataset绑定books数据表 2007-08-08 10:10:10<BR> // myCommand.Fill(myDataSet, "数据检测");<BR> myConn.Open();<BR> string strInsert = " INSERT INTO 数据检测 ( 图像,结果,高度1,高度2,灰度值,序号,检测时间 ) VALUES ( '";strInsert += textBox1.Text.ToString() + "', '";strInsert += textBox2.Text.ToString() + "', '";strInsert += textBox3.Text.ToString() + "', '";strInsert += textBox4.Text.ToString() + "', '";strInsert += textBox5.Text.ToString() + "','";strInsert += textBox6.Text.ToString() + "','";strInsert += textBox7.Text.ToString() + "')";<BR> OleDbCommand inst = new OleDbCommand(strInsert, myConn);<BR> inst.ExecuteNonQuery();<BR> </P>
<P> myConn.Close();<BR> }<BR> else<BR> {<BR> MessageBox.Show("必须填满所有字段值!", "错误!");<BR> }<BR> }<BR> catch (Exception ed)<BR> {<BR> MessageBox.Show("保存数据记录发生 " + ed.ToString(), "错误!");<BR> }</P>
<P> }<BR><BR>运行后提示 查询值的数目与目标字段中的数目不同<BR><BR>大家帮我看看是哪儿的毛病</P>
页:
[1]
