用循环开几个线程,该线程对表进行插入操作,每次只能插入一条,其余都失败,这
是否是多用户不能对表同时更新操作问题?
代码如下:
PECCANCY* dbThread = (PECCANCY)lpParam;if(!gpPeccancy->CanAppend())
{
return 0;
}
try
{
gpPeccancy->SetFieldNull(NULL);
gpPeccancy->AddNew(); //这里给字段赋值 if(!gpPeccancy->CanUpdate())
{
return 0;
} gpPeccancy->Update();
}
catch(CDBException* e)
{
e->Delete();
return 0;
}if(dbThread != NULL)
{
delete dbThread;
dbThread = NULL;
}return 0;//gpPeccancy为全局变量,在线程外已经打开
//执行以上代码,程序死掉;如果在Update()之前加一个MessageBox,则只能插入一条,其余失败???
是否是多用户不能对表同时更新操作问题?
代码如下:
PECCANCY* dbThread = (PECCANCY)lpParam;if(!gpPeccancy->CanAppend())
{
return 0;
}
try
{
gpPeccancy->SetFieldNull(NULL);
gpPeccancy->AddNew(); //这里给字段赋值 if(!gpPeccancy->CanUpdate())
{
return 0;
} gpPeccancy->Update();
}
catch(CDBException* e)
{
e->Delete();
return 0;
}if(dbThread != NULL)
{
delete dbThread;
dbThread = NULL;
}return 0;//gpPeccancy为全局变量,在线程外已经打开
//执行以上代码,程序死掉;如果在Update()之前加一个MessageBox,则只能插入一条,其余失败???
解决方案 »
- com技术内幕的一个疑惑
- 请问各位大虾不是函数为何要返回值
- 对话框程序,改变了背景颜色再改变了EDIT控件颜色,但EDIT控件的白色边(3D边框)不知如何改颜色?
- 请教二问题,谢谢!!!!
- 如何使状态栏的高度重定义!
- setup factory如何把库文件mfc71.dll自动加到c:\windows\system32下
- Com中调用另一个COM的问题
- 学习windows C编程时,对话框显示不出来
- 请问用VirtualAlloc()分配的存储页面保护属性中EXECUTE与READ有什么不同?
- 远程登录到SQL数据库后,如何创建纪录集??
- 请教如何让 CFormView 里的对话框跟随主程序大小的变化而变化?
- html控件与web服务控件有什么区别
{
goto exit;
}
try
{
gpPeccancy->SetFieldNull(NULL);
gpPeccancy->AddNew(); //这里给字段赋值 if(!gpPeccancy->CanUpdate())
{
goto exit;
} gpPeccancy->Update();
}
catch(CDBException* e)
{
e->Delete();
goto exit;
}exit:
gcs.Unlock();if(dbThread != NULL)
{
delete dbThread;
dbThread = NULL;
}return 0;