【delphi开源代码栏目提醒】:网学会员--在 delphi开源代码编辑为广大网友搜集整理了:XSGLCommon.pas绩等信息,祝愿广大网友取得需要的信息,参考学习。
unit XSGLCommon;
interface
uses
Windows, SysUtils, DB, DBGrids;
Resourcestring
conIniFile = 'System\Server.ini';
var
EXEPath: string; //主
程序路径
function GetExePath: string;
procedure InitDBGrid(AFields: TDataSet; ADBGrid: TDBGrid);
function IsNumeric(const s: string): Boolean;
implementation
function GetExePath: string;
begin
Result := ExtractFilePath(ParamStr(0));
end;
procedure InitDBGrid(AFields: TDataSet; ADBGrid: TDBGrid);
var
l_Col:TColumn;
begin
ADBGrid.Columns.Clear;
AFields.First;
while not AFields.Eof do
begin
l_COL := ADBGrid.Columns.Add;
with l_COL, AFields do
begin
FieldName := Trim(FieldByName('FieldName').AsString);
Title.Caption := Trim(FieldByName('TitleName').AsString);
Width := FieldByname('Width').AsInteger;
end;
AFields.Next;
end;
end;
function IsNumeric(const s: string): Boolean;
var
l_Code: Integer;
l_Str: string;
F: Double;
begin
Result := True;
l_Str := Trim(s);
try
Val(l_Str, F, l_Code);
except
Result := False;
end;
Result := Result and (l_Code = 0);
if Length(l_Str) >= 1 then
Result := Result and (not (l_Str[1] in ['e', 'E']));
end;
end.