| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
学习型 ASP/PHP/ASP.NET 主机 35元/年全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
赛孚耐:软件保护加密专家身份认证令牌USB KEY  
共有 859 人关注过本帖
标题:查询值的数目与目标字段中的数目不同
收藏  订阅  推荐  打印 
剑飞
Rank: 1
等级:新手上路
帖子:27
积分:370
注册:2007-5-6
查询值的数目与目标字段中的数目不同

private void Save_Click(object sender, EventArgs e)
{
try
{
//判断所有字段是否添完,添完则执行,反之弹出提示
if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text!="")
{
string strConn = @" Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = D:\C#\Display Control\检测结果.mdb ";
OleDbConnection myConn = new OleDbConnection(strConn);

//把Dataset绑定books数据表 2007-08-08 10:10:10
// myCommand.Fill(myDataSet, "数据检测");
myConn.Open();
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() + "')";
OleDbCommand inst = new OleDbCommand(strInsert, myConn);
inst.ExecuteNonQuery();

myConn.Close();
}
else
{
MessageBox.Show("必须填满所有字段值!", "错误!");
}
}
catch (Exception ed)
{
MessageBox.Show("保存数据记录发生 " + ed.ToString(), "错误!");
}

}

运行后提示 查询值的数目与目标字段中的数目不同

大家帮我看看是哪儿的毛病

搜索更多相关主题的帖子: 字段  Microsoft  目标  
2007-6-7 11:23
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.057393 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved