本文介绍了Orcale插入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
我遇到了这个问题的两难处境,我有一个拥有页面的前端应用程序,到目前为止它运行良好,现在很不幸,它无法运行,然后我发现了这个问题
<命令参数[19]''''数据值由于符号不匹配或数据溢出以外的原因而无法转换. >
我将测试所有可能的数据转换,但无法确切了解发生了什么
代码在下面
Dear,
I am in dilemma with this problems,I have a front end application that have a page,so far it was working well,now unfortunately not work,then I found out this problem
<Command parameter[19] '''' data value could not be converted for reasons other than sign mismatch or data overflow. >
I will test all possible data conversion but not getting exactly what happened
the code bellow
try
{
string strSql = "select ASSET_NAME,ASSET_TYPE_ID,QTY,UNIT_ID,UNIT_COST,ACQUISITION_DATE,RATE_OF_DEPRE,ASSET_COST,ACQUISITION_COST,ACQUISITION_EXPENSE,INSTALLATION_COST,BOOK_VALUE,DEPRECIABLE_COST,TOTAL_DEPRE_CHARGED,SALVAGE_VALUE,IDENTIFICATION_MARK,USEFUL_LIFE_YEAR,DEPT_ID,VENDOR_ID,DESCRIPTION,PARTICULARS,FIRST_YEAR_DEPRE_RATE,INITIAL_DEPRE_AMT,COST_VOUCHER_NO,TOTALASSETCOST,ASSETNO,CMP_BRANCH_ID,MEETINGNO from AT_ASSET_MASTER";
DataRow oOrderRow;
OleDbConnection conn = new OleDbConnection(strConString);
DataSet oDs = new DataSet();
OleDbDataAdapter oDbAdapter = new OleDbDataAdapter(new OleDbCommand(strSql, conn));
OleDbCommandBuilder oDbCmdBuilder = new OleDbCommandBuilder(oDbAdapter);
oDbAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
oDbAdapter.Fill(oDs, "AT_ASSET_MASTER");
// Insert the Data
oOrderRow = oDs.Tables["AT_ASSET_MASTER"].NewRow();
oOrderRow["ASSET_NAME"] = AssetName;
oOrderRow["ASSET_TYPE_ID"] = assetTypeID;
oOrderRow["DESCRIPTION"] = AssetDescription;
oOrderRow["UNIT_ID"] = Unit;
oOrderRow["IDENTIFICATION_MARK"] = IdentificationMarks;
oOrderRow["ACQUISITION_DATE"] =Convert.ToDateTime(acquisitionDate);
oOrderRow["VENDOR_ID"] = SupplierID;
oOrderRow["DEPT_ID"] = DepartmentID;
oOrderRow["QTY"] = qty;
oOrderRow["UNIT_COST"] = Convert.ToDouble(unitCost);
oOrderRow["TOTALASSETCOST"] =Convert.ToDouble(totalCost);
oOrderRow["ACQUISITION_EXPENSE"] = Convert.ToDouble(AcquisitionExpense);
oOrderRow["INSTALLATION_COST"] = Convert.ToDouble(InstallCost);
oOrderRow["ASSET_COST"] = Convert.ToDouble(NetAssetCost);
oOrderRow["COST_VOUCHER_NO"] = CostVoucherNo;
oOrderRow["RATE_OF_DEPRE"] =DepreciationRate;
oOrderRow["USEFUL_LIFE_YEAR"] = DepreciationLife;
oOrderRow["DEPRECIABLE_COST"] = Convert.ToDouble(DepreciableCost);
oOrderRow["BOOK_VALUE"] =Convert.ToDouble(BookValue);
oOrderRow["SALVAGE_VALUE"] = Convert.ToDouble(SalvageValue);
oOrderRow["MEETINGNO"] = strMeetingNO;
//oOrderRow["INITIAL_DEPRE_AMT"] = FrstyrDepAmt;
oOrderRow["ASSETNO"] = AssetNO;
oOrderRow["CMP_BRANCH_ID"] = BranchID;
oDs.Tables["AT_ASSET_MASTER"].Rows.Add(oOrderRow);
oDbAdapter.Update(oDs, "AT_ASSET_MASTER");
}
catch (Exception ex)
{
return null;
}
任何帮助将不胜感激.
Mahmud
any help will be thankfully appreciate.
Mahmud
推荐答案
oOrderRow["USEFUL_LIFE_YEAR"] = DepreciationLife;
oOrderRow["DEPRECIABLE_COST"] = Convert.ToDouble(DepreciableCost);
在调试器中运行,并检查对象类型.
Run in a debugger and check the object types.
string strSql = "select ASSET_NAME,ASSET_TYPE_ID,QTY,UNIT_ID,UNIT_COST,ACQUISITION_DATE,RATE_OF_DEPRE,ASSET_COST,ACQUISITION_COST,ACQUISITION_EXPENSE,INSTALLATION_COST,BOOK_VALUE,DEPRECIABLE_COST,TOTAL_DEPRE_CHARGED,SALVAGE_VALUE,IDENTIFICATION_MARK,USEFUL_LIFE_YEAR,DEPT_ID,VENDOR_ID,DESCRIPTION,PARTICULARS,FIRST_YEAR_DEPRE_RATE,INITIAL_DEPRE_AMT,COST_VOUCHER_NO,TOTALASSETCOST,ASSETNO,CMP_BRANCH_ID,MEETINGNO from AT_ASSET_MASTER where 1=-1";
这篇关于Orcale插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!