H
hjp0214
Unregistered / Unconfirmed
GUEST, unregistred user!
这是连接应用服务器和客户端的一个对象:
unit uobCommon;
interface
uses SConnect, Classes, CommonS_TLB,upb0Type;
type
TASCommon = class(TObject)
private
FscCommon:TSocketConnection;
FIDCommon:IrmCommonDisp;
procedure SocketConnection;
public
constructor Create(scCommon:TSocketConnection);
destructor Destroy;override;
//取得指定表名pTableName中条件为pWhereSQL的记录的指定字段pFieldName值的列表
function GetValueList(const pTableName, pFieldName, pWhereSQL: string): String;
//取得指定表名pTblName中条件为pFilerSQL的记录中指定字段pNoField的最大值
function GetMaxStringNo(const pTblName, pNoField, pFilerSQL: string): string;
//检查指定的表名pChkTable是否存在条件为pOtherSQL且字段pChkField值为pChkValue的记录
//如果是返回True,否则返回False
function CheckIsUse(const pChkTable, pChkField, pOtherSQL,
pChkValue: string): Boolean;
//取得数据表对应的最大的ID号的函数类型
function GetMaxID(const pTableName, pOwnerSys: string): Integer;
//取得当前用户是否拥有指定的权限
function CheckHasAble(const pAbleCode, pAbleName, pAbleClass, pOwnerSys,
pUserID: string): Boolean;
function GetAblHold(pAbleInfo:TAbleInfo): TAbleInfo;
function SQL_Exec(const vSQL: WideString): Boolean;
function SQL_Open(const vSQL: WideString;
var vData: OleVariant): Boolean;
function SQL_Save(const vSQL: WideString;
vData: OleVariant): Boolean;
end;
implementation
uses upb0Unit, SysUtils;
{ TASCommon }
constructor TASCommon.Create(scCommon:TSocketConnection);
begin
FscCommon:=scCommon;
end;
destructor TASCommon.Destroy;
begin
FscCommon:=nil;
inherited;
end;
procedure TASCommon.SocketConnection;
begin
if not FscCommon.Connected then
FscCommon.Connected:=True;
if FIDCommon = nil then
FIDCommon:=IrmCommonDisp(IDispatch(FscCommon.GetServer));
end;
function TASCommon.CheckHasAble(const pAbleCode, pAbleName, pAbleClass,
pOwnerSys, pUserID: string): Boolean;
begin
SocketConnection;
Result := FIDCommon.CheckHasAble(pAbleCode, pAbleName, pAbleClass, pOwnerSys, pUserID);
end;
function TASCommon.CheckIsUse(const pChkTable, pChkField, pOtherSQL,
pChkValue: string): Boolean;
begin
SocketConnection;
Result := FIDCommon.CheckIsUse(pChkTable, pChkField, pOtherSQL, pChkValue);
end;
function TASCommon.GetMaxID(const pTableName,
pOwnerSys: string): Integer;
begin
SocketConnection;
Result:=FIDCommon.GetMaxID(pTableName, pOwnerSys);
end;
function TASCommon.GetMaxStringNo(const pTblName, pNoField,
pFilerSQL: string): string;
begin
SocketConnection;
Result:=FIDCommon.GetMaxStringNo(pTblName, pNoField, pFilerSQL);
end;
function TASCommon.GetValueList(const pTableName,
pFieldName, pWhereSQL: string): String;
begin
SocketConnection;
Result := FIDCommon.GetValueList(pTableName, pFieldName, pWhereSQL);
end;
function TASCommon.SQL_Exec(const vSQL: WideString): Boolean;
begin
SocketConnection;
Result:=FIDCommon.SQL_Exec(vSQL);
end;
function TASCommon.SQL_Open(const vSQL: WideString;
var vData: OleVariant): Boolean;
begin
SocketConnection;
Result:=FIDCommon.SQL_Open(vSQL,vData);
end;
function TASCommon.SQL_Save(const vSQL: WideString;
vData: OleVariant): Boolean;
begin
SocketConnection;
Result:=FIDCommon.SQL_Save(vSQL, vData);
end;
function TASCommon.GetAblHold(pAbleInfo:TAbleInfo): TAbleInfo;
var
nAblInfo:OleVariant;
begin
Result:=pAbleInfo;
SocketConnection;
nAblInfo:=FIDCommon.GetAblHold(pAbleInfo.vAbleCode,pAbleInfo.vAbleClass,pAbleInfo.vUserID);
Result.vRead :=nAblInfo[0];
Result.vEdit :=nAblInfo[1];
Result.vPrint:=nAblInfo[2];
end;
end.
客户端的socket supportCallback=false
为什么在主程序运行一段时间,会突然出现Error Read From Socket!
这个对象是连接公用应用服务器????
unit uobCommon;
interface
uses SConnect, Classes, CommonS_TLB,upb0Type;
type
TASCommon = class(TObject)
private
FscCommon:TSocketConnection;
FIDCommon:IrmCommonDisp;
procedure SocketConnection;
public
constructor Create(scCommon:TSocketConnection);
destructor Destroy;override;
//取得指定表名pTableName中条件为pWhereSQL的记录的指定字段pFieldName值的列表
function GetValueList(const pTableName, pFieldName, pWhereSQL: string): String;
//取得指定表名pTblName中条件为pFilerSQL的记录中指定字段pNoField的最大值
function GetMaxStringNo(const pTblName, pNoField, pFilerSQL: string): string;
//检查指定的表名pChkTable是否存在条件为pOtherSQL且字段pChkField值为pChkValue的记录
//如果是返回True,否则返回False
function CheckIsUse(const pChkTable, pChkField, pOtherSQL,
pChkValue: string): Boolean;
//取得数据表对应的最大的ID号的函数类型
function GetMaxID(const pTableName, pOwnerSys: string): Integer;
//取得当前用户是否拥有指定的权限
function CheckHasAble(const pAbleCode, pAbleName, pAbleClass, pOwnerSys,
pUserID: string): Boolean;
function GetAblHold(pAbleInfo:TAbleInfo): TAbleInfo;
function SQL_Exec(const vSQL: WideString): Boolean;
function SQL_Open(const vSQL: WideString;
var vData: OleVariant): Boolean;
function SQL_Save(const vSQL: WideString;
vData: OleVariant): Boolean;
end;
implementation
uses upb0Unit, SysUtils;
{ TASCommon }
constructor TASCommon.Create(scCommon:TSocketConnection);
begin
FscCommon:=scCommon;
end;
destructor TASCommon.Destroy;
begin
FscCommon:=nil;
inherited;
end;
procedure TASCommon.SocketConnection;
begin
if not FscCommon.Connected then
FscCommon.Connected:=True;
if FIDCommon = nil then
FIDCommon:=IrmCommonDisp(IDispatch(FscCommon.GetServer));
end;
function TASCommon.CheckHasAble(const pAbleCode, pAbleName, pAbleClass,
pOwnerSys, pUserID: string): Boolean;
begin
SocketConnection;
Result := FIDCommon.CheckHasAble(pAbleCode, pAbleName, pAbleClass, pOwnerSys, pUserID);
end;
function TASCommon.CheckIsUse(const pChkTable, pChkField, pOtherSQL,
pChkValue: string): Boolean;
begin
SocketConnection;
Result := FIDCommon.CheckIsUse(pChkTable, pChkField, pOtherSQL, pChkValue);
end;
function TASCommon.GetMaxID(const pTableName,
pOwnerSys: string): Integer;
begin
SocketConnection;
Result:=FIDCommon.GetMaxID(pTableName, pOwnerSys);
end;
function TASCommon.GetMaxStringNo(const pTblName, pNoField,
pFilerSQL: string): string;
begin
SocketConnection;
Result:=FIDCommon.GetMaxStringNo(pTblName, pNoField, pFilerSQL);
end;
function TASCommon.GetValueList(const pTableName,
pFieldName, pWhereSQL: string): String;
begin
SocketConnection;
Result := FIDCommon.GetValueList(pTableName, pFieldName, pWhereSQL);
end;
function TASCommon.SQL_Exec(const vSQL: WideString): Boolean;
begin
SocketConnection;
Result:=FIDCommon.SQL_Exec(vSQL);
end;
function TASCommon.SQL_Open(const vSQL: WideString;
var vData: OleVariant): Boolean;
begin
SocketConnection;
Result:=FIDCommon.SQL_Open(vSQL,vData);
end;
function TASCommon.SQL_Save(const vSQL: WideString;
vData: OleVariant): Boolean;
begin
SocketConnection;
Result:=FIDCommon.SQL_Save(vSQL, vData);
end;
function TASCommon.GetAblHold(pAbleInfo:TAbleInfo): TAbleInfo;
var
nAblInfo:OleVariant;
begin
Result:=pAbleInfo;
SocketConnection;
nAblInfo:=FIDCommon.GetAblHold(pAbleInfo.vAbleCode,pAbleInfo.vAbleClass,pAbleInfo.vUserID);
Result.vRead :=nAblInfo[0];
Result.vEdit :=nAblInfo[1];
Result.vPrint:=nAblInfo[2];
end;
end.
客户端的socket supportCallback=false
为什么在主程序运行一段时间,会突然出现Error Read From Socket!
这个对象是连接公用应用服务器????