pComm->ActiveConnection = pDsConn;
pComm->CommandType = adCmdText;
pComm->CommandText ="INSERT INTO ServicePrice(sCode,sName,iLevel,sFinanceClass,sDefinition,sExcept,sUnit,fPrice0,fPrice1,fPrice02,sMemo,bEnd) VALUES (@sCode,@sName,@iLevel,@sFinanceClass,@sDefinition,@sExcept,@sUnit,@fPrice0,@fPrice1,@fPrice02,@sMemo,@bEnd)";
pParams = pComm->Parameters;
pParams->Append(pComm->CreateParameter("@sCode" , adVarChar , adParamInput , 20 ));
pParams->Append(pComm->CreateParameter("@sName" , adVarChar , adParamInput , 50 ));
pParams->Append(pComm->CreateParameter("@iLevel" , adInteger , adParamInput , 4 ));
pParams->Append(pComm->CreateParameter("@sFinanceClass" , adVarChar , adParamInput , 50 ));
pParams->Append(pComm->CreateParameter("@sDefinition" , adVarChar , adParamInput , 1000));
pParams->Append(pComm->CreateParameter("@sExcept" , adVarChar , adParamInput , 1000));
pParams->Append(pComm->CreateParameter("@sUnit" , adVarChar , adParamInput , 10 ));
pParams->Append(pComm->CreateParameter("@fPrice0" , adDouble , adParamInput , 8 ));
pParams->Append(pComm->CreateParameter("@fPrice1" , adDouble , adParamInput , 8 ));
pParams->Append(pComm->CreateParameter("@fPrice2" , adDouble , adParamInput , 8 ));
pParams->Append(pComm->CreateParameter("@sMemo" , adVarChar , adParamInput , 1000));
pParams->Append(pComm->CreateParameter("@sEnd" , adBoolean , adParamInput , 1 ));pTempData->Close();
pParams->GetItem("@sCode")->Value = sCode;
pParams->GetItem("@sName")->Value = sName;
pParams->GetItem("@iLevel")->Value = nLevel;
pParams->GetItem("@sFinanceClass")->Value = sFinanceClass;
pParams->GetItem("@sDefinition")->Value = sDefinition;
pParams->GetItem("@sExcept")->Value = sExcept;
pParams->GetItem("@sUnit")->Value = sUnit;
pParams->GetItem("@fPrice0")->Value = fPrice0;
pParams->GetItem("@fPrice1")->Value = fPrice1;
pParams->GetItem("@fPrice2")->Value = fPrice2;
pParams->GetItem("@sMemo")->Value = sMemo;
pParams->GetItem("@sEnd")->Value = bEnd; pComm->Execute(&varAffect , NULL ,adCmdText);
pComm->CommandType = adCmdText;
pComm->CommandText ="INSERT INTO ServicePrice(sCode,sName,iLevel,sFinanceClass,sDefinition,sExcept,sUnit,fPrice0,fPrice1,fPrice02,sMemo,bEnd) VALUES (@sCode,@sName,@iLevel,@sFinanceClass,@sDefinition,@sExcept,@sUnit,@fPrice0,@fPrice1,@fPrice02,@sMemo,@bEnd)";
pParams = pComm->Parameters;
pParams->Append(pComm->CreateParameter("@sCode" , adVarChar , adParamInput , 20 ));
pParams->Append(pComm->CreateParameter("@sName" , adVarChar , adParamInput , 50 ));
pParams->Append(pComm->CreateParameter("@iLevel" , adInteger , adParamInput , 4 ));
pParams->Append(pComm->CreateParameter("@sFinanceClass" , adVarChar , adParamInput , 50 ));
pParams->Append(pComm->CreateParameter("@sDefinition" , adVarChar , adParamInput , 1000));
pParams->Append(pComm->CreateParameter("@sExcept" , adVarChar , adParamInput , 1000));
pParams->Append(pComm->CreateParameter("@sUnit" , adVarChar , adParamInput , 10 ));
pParams->Append(pComm->CreateParameter("@fPrice0" , adDouble , adParamInput , 8 ));
pParams->Append(pComm->CreateParameter("@fPrice1" , adDouble , adParamInput , 8 ));
pParams->Append(pComm->CreateParameter("@fPrice2" , adDouble , adParamInput , 8 ));
pParams->Append(pComm->CreateParameter("@sMemo" , adVarChar , adParamInput , 1000));
pParams->Append(pComm->CreateParameter("@sEnd" , adBoolean , adParamInput , 1 ));pTempData->Close();
pParams->GetItem("@sCode")->Value = sCode;
pParams->GetItem("@sName")->Value = sName;
pParams->GetItem("@iLevel")->Value = nLevel;
pParams->GetItem("@sFinanceClass")->Value = sFinanceClass;
pParams->GetItem("@sDefinition")->Value = sDefinition;
pParams->GetItem("@sExcept")->Value = sExcept;
pParams->GetItem("@sUnit")->Value = sUnit;
pParams->GetItem("@fPrice0")->Value = fPrice0;
pParams->GetItem("@fPrice1")->Value = fPrice1;
pParams->GetItem("@fPrice2")->Value = fPrice2;
pParams->GetItem("@sMemo")->Value = sMemo;
pParams->GetItem("@sEnd")->Value = bEnd; pComm->Execute(&varAffect , NULL ,adCmdText);
解决方案 »
- 求助……关于MFC日期时间选取器控件的问题
- MFC动态创建表
- MFC 动态控件,并实行对多个控件的滚动浏览???
- [求助]如何在VC中使用??
- 如何知道一个文件是否正在被FTP用户写入?
- 请问哪里有sdk下载?
- windows的附件里的画图工具的调色板是怎么实现的?
- 怎样调用别人的东西?
- 在COM+事务性组件中,如果在未调用GetObjectContext.SetComplete前结束调用,事务为什么竟然提交了,请指教,谢谢!!!
- 《程序员》杂志将在“首届微软亚洲最有价值专家峰会”期间专访微软公司产品技术支持服务副总裁罗莉.摩尔,你有什么关心的话题?
- 程序正常关闭,仍有进程未退出
- 真不容易呀 帮帮忙数据问题
用SQL Server事件探察器发现只有INSERT INTO ServicePrice(sCode,sName,iLevel,sFinanceClass,sDefinition,sExcept,sUnit,fPrice0,fPrice1,fPrice02,sMemo,bEnd) VALUES (@sCode,@sName,@iLevel,@sFinanceClass,@sDefinition,@sExcept,@sUnit,@fPrice0,@fPrice1,@fPrice02,@sMemo,@bEnd)语句,并无相关的参数定义。(记得带参数的SQL语句应通过调用sp_executesql执行)
First-chance exception in Database.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.报这个错误
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
TRACE("Error\n");
TRACE("Code = %08lx\n", e.Error());
TRACE("Code meaning = %s\n", e.ErrorMessage());
TRACE("Source = %s\n", (LPCSTR) bstrSource);
TRACE("Description = %s\n", (LPCSTR) bstrDescription);
return;
}
增加如上的catch,看看bstrDescription是什么内容
这句明显的是直接执行SQL语句,但是里面带了执行存储过程的@...格式语句。pParams = pComm->Parameters;
pParams->Append(pComm->CreateParameter("@sCode" , adVarChar , adParamInput , 20 ));这样的明显是存储过程的参数设置。