D
Dephic
Unregistered / Unconfirmed
GUEST, unregistred user!
一个奇怪的问题,在一个按钮事件里启动两个COM+,第二个总会死掉,但把其分开到两个按钮的事件里,就没事!
代码:
。。。。
public
{ Public declarations }
vmtsDataDictionaryQuery : IDataDictionaryQuery;
vmtsCreditManageQuery : ICreditManageQuery;
vmtsCreditManageUpdate : ICreditManageUpdate;
。。。。。
procedure TSetSpecialtyCredit_F.BitBtn2Click(Sender: TObject);
var
vDatas : OleVariant;
sMessage : WideString;
begin
if (trim(edtGradeInSchool.Text) = '') or (trim(edtTerm.Text) = '') or (trim(cbSpecialtyName.Text) = '')
then
begin
Application.MessageBox('必须指定年级,专业,学期,才能进行数据倒入!','消息',MB_OK);
exit;
end;
Screen.Cursor := crHourGlass;
GradeInSchool := edtGradeInSchool.Text ;
Term := edtTerm.Text ;
SpecialtyNo := arrSpecialtyNo[cbSpecialtyName.ItemIndex] ;
//从教学执行计划中导入数据
if vmtsCreditManageUpdate = nil then
vmtsCreditManageUpdate := CoCreditManageUpdate.CreateRemote('WDQ');//启动远程COM+
vmtsCreditManageUpdate.InsertIntoTermLessonFromRunSpecialty(GradeInSchool, Term, SpecialtyNo,sMessage);
if sMessage <> '操作成功!' then
begin
Screen.Cursor := crDefault;
showmessage(sMessage);
exit;
end;
if vmtsCreditManageQuery = nil then
vmtsCreditManageQuery := CoCreditManageQuery.CreateRemote('WDQ');
//启动远程COM+
//取值
vmtsCreditManageQuery.GetTermlesson(GradeInSchool,//调用接口
SpecialtyNo,
'%',
'%',
'%', //课程类型代码,必修,选修等
'%',
'%',
'0',
'1',
Term,
'0',
'1',
vDatas,
sMessage,
SqlStr);
cdsSpecialtyCredit.Close ;
cdsSpecialtyCredit.Data := vDatas;
cdsSpecialtyCredit.Open ;
end;
由于把其分在两个按钮的事件里执行没问题,所以应该不是COM+里出现的错误!
还有个问题就是:要启动远程COM+一定得有"COM+模块名"_TLB.dcu 和.pas进行编译,
而且还要在本地装上那个COM+才能调用远程的COM+,这是为什么?有没有解决办法?
代码:
。。。。
public
{ Public declarations }
vmtsDataDictionaryQuery : IDataDictionaryQuery;
vmtsCreditManageQuery : ICreditManageQuery;
vmtsCreditManageUpdate : ICreditManageUpdate;
。。。。。
procedure TSetSpecialtyCredit_F.BitBtn2Click(Sender: TObject);
var
vDatas : OleVariant;
sMessage : WideString;
begin
if (trim(edtGradeInSchool.Text) = '') or (trim(edtTerm.Text) = '') or (trim(cbSpecialtyName.Text) = '')
then
begin
Application.MessageBox('必须指定年级,专业,学期,才能进行数据倒入!','消息',MB_OK);
exit;
end;
Screen.Cursor := crHourGlass;
GradeInSchool := edtGradeInSchool.Text ;
Term := edtTerm.Text ;
SpecialtyNo := arrSpecialtyNo[cbSpecialtyName.ItemIndex] ;
//从教学执行计划中导入数据
if vmtsCreditManageUpdate = nil then
vmtsCreditManageUpdate := CoCreditManageUpdate.CreateRemote('WDQ');//启动远程COM+
vmtsCreditManageUpdate.InsertIntoTermLessonFromRunSpecialty(GradeInSchool, Term, SpecialtyNo,sMessage);
if sMessage <> '操作成功!' then
begin
Screen.Cursor := crDefault;
showmessage(sMessage);
exit;
end;
if vmtsCreditManageQuery = nil then
vmtsCreditManageQuery := CoCreditManageQuery.CreateRemote('WDQ');
//启动远程COM+
//取值
vmtsCreditManageQuery.GetTermlesson(GradeInSchool,//调用接口
SpecialtyNo,
'%',
'%',
'%', //课程类型代码,必修,选修等
'%',
'%',
'0',
'1',
Term,
'0',
'1',
vDatas,
sMessage,
SqlStr);
cdsSpecialtyCredit.Close ;
cdsSpecialtyCredit.Data := vDatas;
cdsSpecialtyCredit.Open ;
end;
由于把其分在两个按钮的事件里执行没问题,所以应该不是COM+里出现的错误!
还有个问题就是:要启动远程COM+一定得有"COM+模块名"_TLB.dcu 和.pas进行编译,
而且还要在本地装上那个COM+才能调用远程的COM+,这是为什么?有没有解决办法?