?? u_dbtrans1.pas
字號:
unit U_dbtrans1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, StdCtrls, DB, ADODB, DBTables;
type
Tdbtrans = class(TForm)
fromaccessquery_1: TADOQuery;
fromaccessquery_3: TADOQuery;
fromaccessquery_2: TADOQuery;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Button1: TButton;
Button2: TButton;
bsSkinGauge1: TbsSkinGauge;
Button3: TButton;
Memo1: TMemo;
tosqlserver: TADOQuery;
tosqlserverB: TADOQuery;
bsSkinGauge2: TbsSkinGauge;
Table1: TTable;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
procedure ODBCcreate;
{ Private declarations }
public
{ Public declarations }
end;
var
dbtrans: Tdbtrans;
var pathname:string;
implementation //注冊表單元文件
uses U_dbTread,registry,u_checkaccess,u_dmd;////注冊表單元文件;//引用U_CHECKACCESS單元中PATHNAME變量
{$R *.dfm}
procedure Tdbtrans.Button1Click(Sender: TObject);
begin
mydbthread.create(false);
end;
procedure Tdbtrans.Button2Click(Sender: TObject);
begin
close;
end;
procedure Tdbtrans.Button3Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
pathname:=opendialog1.FileName;
dbtrans.ODBCcreate;
end;
end;
procedure Tdbtrans.ODBCcreate;//動態建立ODBC數據源
var
reg:TRegistry;
data:array[0..0]of byte;
begin
reg:=TRegistry.Create;
with reg do
begin
Rootkey:=HKEY_CURRENT_USER;
if OpenKey('Software\ODBC\ODBC.INI\ODBC Data Sources',True) then
begin
WriteString('XSJ','Microsoft Access Driver(*.mdb)');
end
else
begin
showmessage('載入失敗,無法進行數據庫轉換');
exit;
end;
CloseKey;
if OpenKey('Software\ODBC\ODBC.INI\XSJ',True) then
begin
WriteString('DBQ',pathname);
// WriteString('description','時勢軟件');
WriteString('Driver','C:\WINDOWS\system32\odbcjt32.dll');
WriteInteger('DriverId',25);
WriteString('FIL','MS Access;');
WriteInteger('SafeTransactions',0);
WriteString('UID','');
Data[0]:=0;
// WriteBinaryData('Exclusive',Data,1);
// WriteBinaryData('ReadOnly',Data,1);
end
else
begin
showmessage('載入失敗,無法進行數據庫轉換');
exit;
end;
CloseKey;
if OpenKey('Software\ODBC\ODBC.INI\XSJ\Engines\Jet',True) then
begin
WriteString('ImplicitCommitSync','');
WriteInteger('MaxBufferSize',2048);
WriteInteger('PageTimeout',5);
WriteInteger('Threads',3);
WriteString('UserCommitSync','Yes');
end
else
begin
showmessage('載入失敗,無法進行數據庫轉換');
exit;
end;
CloseKey;
showmessage('載入成功');
free;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -