首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

在保存图象到access异常

2012-01-10 
在保存图象到access错误!f(this.JudgeTextIsNotNull()false){MessageBox.Show( 输入不完整 , 消息提

在保存图象到access错误!
f(this.JudgeTextIsNotNull()==false)
{
MessageBox.Show( "输入不完整 ", "消息提示 ",MessageBoxButtons.OK,MessageBoxIcon.Information);  
return;
}
frm.OpenDataBaseConnect();  
if(this.ReturnDataInDataBase(this.cmbType.Text)==0)
{
frm.OpenDataBaseConnect();  
string   InsertType= "insert   into   type(typename)   value( ' "   +   this.cmbType.Text   +   " ')   ";

OleDbCommand   OleCmd   =   new   OleDbCommand(InsertType,frm.OleCnn);
   
OleCmd.ExecuteNonQuery();
}
frm.OpenDataBaseConnect();  

//string   StrSql= "select   *   from   PanDefine ";
//OleDbDataAdapter   OleAdp   =   new   OleDbDataAdapter(StrSql,frm.OleCnn);  

this.OleDbImage.Fill(this.dstImage);    
 
DataRow   NewRow   =   this.dstImage.Tables[0].NewRow();  
                               
NewRow[1]=Convert.ToInt32(   this.txtNo.Text.Trim());
NewRow[ "NAME "]=this.txtName.Text.Trim();
NewRow[ "TYPE "]=this.cmbType.Text.Trim();
NewRow[ "MAX "]=Convert.ToInt32   (this.txtMax.Text.Trim());
NewRow[ "MIN "]=Convert.ToInt32   (this.txtMin.Text.Trim());
NewRow[ "TEXT "]=this.txtText.Text.Trim();
NewRow[ "R1 "]=this.txtR1.Text.Trim();
NewRow[ "R2 "]=this.txtR2.Text.Trim();
NewRow[ "R3 "]=this.txtR3.Text.Trim();
NewRow[ "R4 "]=this.ImageCount;
       
this.dstImage.Tables[0].Rows.Add(NewRow);    
DataSet   TempDt   =   this.dstImage.GetChanges();
 
this.OleDbImage.Update(TempDt);  
//frm.CloseDataBaseConnect();  
this.DialogResult=DialogResult.Yes;  

代码运行到
this.OleDbImage.Update(TempDt);  
提示出错为:
未处理的“System.Data.OleDb.OleDbException”类型的异常出现在   system.data.dll   中。

请教高手

[解决办法]
catch一下OleDbException,看看具体报什么错
[解决办法]
OleDbImage没有updatecommand?
[解决办法]
你的this.OleDbImage应该是adapter吧
你的updatecommand怎么写的?
[解决办法]
updatecommand怎么写的,为什么你的异常会在system.data.dll 中
catch一下OleDbException,看一下在system.data.dll 的哪个位置

热点排行