?? u_dm.pas
字號:
unit U_DM;
interface
uses
SysUtils, Classes, ADODB, DB;
type
TDM = class(TDataModule)
DS1: TDataSource;
QY1: TADOQuery;
Ads1: TADODataSet;
AdoCnn1: TADOConnection;
Qry: TADOQuery;
AdoCmd: TADOCommand;
private
{ Private declarations }
public
{ Public declarations }
{oracle測試連接}
function OConnectDB(ODBConStr:string):Boolean;
//通用查詢語句
procedure ExecSql(Qry:TAdoQuery;SqlStr:String;Flag:Boolean);
end;
var
DM: TDM;
ODBConStr: string;
SqlStr:string;
implementation
{$R *.dfm}
{oracle測試連接服務(wù)器}
function TDM.OConnectDB(ODBConStr:string):Boolean;
begin
try
Adocnn1.Connected:=False;
Adocnn1.ConnectionString:=ODBConStr;
Adocnn1.Connected:=True;
Result:=True;
except
Result:=False;
Adocnn1.Connected:=False;
end;
end;
//通用查詢語句
procedure TDM.ExecSql(Qry:TAdoQuery;SqlStr:String;Flag:Boolean);
begin
with Qry do
begin
Close;
Sql.Clear;
Sql.Add(SqlStr);
Prepared;
if Flag then
Open
else
ExecSql;
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -