4,011
社区成员
发帖
与我相关
我的任务
分享
#define INSERTSQL "insert into SystemTab(TableId,Key1,Key2,Key3,Key4) values(?,?,?,?,?)"
void SystemTabManager::insert(int pkey1, int TabId)
{
DBConnection* conn=NULL;
SystemTab* pSystemTab=NULL;
try
{
SystemTab::TABLE temp;
temp.key.Key1=pkey1;
temp.key.TableId=TabId;
temp.Key2=1;
conn=&(DBConnectionFactory::getIntance()->getConnection());
Statement& stmt=conn->createDyncStatement(INSERTSQL);
int pos=0;
stmt.setParam(pos++, temp.key.TableId);
stmt.setParam(pos++, temp.key.Key1);
stmt.setParam(pos++, temp.Key2);
stmt.execute();
SystemTab::TABLE tabsystemtab=temp;
tabsystemtab.key.Key1=temp.key.Key1;
pSystemTab=new SystemTabImpl(tabsystemtab);
conn->close();
}
catch (DatabaseException e)
{
if(conn)
conn->close();
}
}
又抛出异常:exception {_m_what=0x076c0968 "INSERT INTO 语句的语法错误。" _m_doFree=1 }