服务器端定义的Appserver接口函数:
function TDBSever.LogInDB(const username,
password: WideString): WideString;
begin
self.adcMain.Connected:=false;
self.adcMain.ConnectionString:='Provider=SQLOLEDB.1;Password='+password+
';Persist Security Info=True;User ID='+username+';Initial Catalog=HisDataBase;Data Source=kjk';
try
self.adcMain.Connected:=true;
except
on E: Exception do
begin
result:='false';
exit;
end;
end;
result:='true';
end;客户端定义的调用函数:
procedure TfrmLogin.Button1Click(Sender: TObject);
var
islogin:string;
begin
islogin:=frmMain.dccSearch.AppServer.LogInDB('hisuser','1');//string(edtName.Text),string(edtPassword.Text));
if islogin='true' then exit
else
begin
Application.MessageBox('用户名或密码错误,请重新输入!','错误',MB_ICONEXCLAMATION);
end;
end;结果运行时出错:Invalid variant operation.
请问是什么原因?
function TDBSever.LogInDB(const username,
password: WideString): WideString;
begin
self.adcMain.Connected:=false;
self.adcMain.ConnectionString:='Provider=SQLOLEDB.1;Password='+password+
';Persist Security Info=True;User ID='+username+';Initial Catalog=HisDataBase;Data Source=kjk';
try
self.adcMain.Connected:=true;
except
on E: Exception do
begin
result:='false';
exit;
end;
end;
result:='true';
end;客户端定义的调用函数:
procedure TfrmLogin.Button1Click(Sender: TObject);
var
islogin:string;
begin
islogin:=frmMain.dccSearch.AppServer.LogInDB('hisuser','1');//string(edtName.Text),string(edtPassword.Text));
if islogin='true' then exit
else
begin
Application.MessageBox('用户名或密码错误,请重新输入!','错误',MB_ICONEXCLAMATION);
end;
end;结果运行时出错:Invalid variant operation.
请问是什么原因?
创建自定义方法,可以 菜单-->View-->Type Library-->右击类名-->new method-->
郁闷,一直没想过问题在这里..........
大意了