unit AktarUnit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, Gauges, StdCtrls, ComCtrls, Grids, DBGrids, ADODB_TLB, ADOR_TLB;
type
TAktarFrm = class(TForm)
Button1: TButton;
Gauge1: TGauge;
StatusBar1: TStatusBar;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
FConnection : OLEVariant;//_Connection;
FRecordSet1 : OLEVariant;//_RecordSet;
FConnectString : string;
end;
var
AktarFrm: TAktarFrm;
path1,tl,x1,x2,x3,x4:String;
d:TextFile;
j:Integer;
implementation
{$R *.DFM}
procedure TAktarFrm.Button1Click(Sender: TObject);
Var
id:Integer;
begin
Path1:='D:\Delphi\ADO\Stok.txt';
AssignFile(d,Path1);
Reset(d);
j:=0;
Gauge1.MaxValue:=24647000;
FRecordSet1.MoveFirst;
While not EOF(d) DO
Begin
j:=j+1;
ReadLn(d,tl);
IF j>3 Then
Begin
Gauge1.Progress:=Gauge1.Progress+Length(tl);
StatusBar1.Panels[2].Text:='İşlem Sürüyor... ['+IntToStr(Gauge1.Progress)+']';
StatusBar1.Repaint;
x1:=TrimRight(Copy(tl,4,16));
x2:=TrimRight(Copy(tl,22,20));
x3:=TrimRight(Copy(tl,200,16));
IF x3<>'' Then
Begin
Try
Begin
FRecordSet1.Fields['CODE'].Value:=x1;
FRecordSet1.Fields['EXPLAIN'].Value:=x2;
FRecordSet1.Fields['PRICE'].Value:=x2;
FRecordSet1.Fields['S_CODE'].Value:=x1;
FRecordSet1.Fields['BARCODE'].Value:=x3;
FRecordSet1.UpdateBatch;
FRecordSet1.MoveNext;
end
except
on E:Exception do
Begin
end;
end;
end;
END;
END;
end;
procedure TAktarFrm.FormActivate(Sender: TObject);
var
V : Variant;
begin
Screen.Cursor := crSQLWait;
FConnectString := 'Data Source=D:\Delphi\ADO\stok_karti.mdb;Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Jet OLEDB:Database Password=ado123;Jet OLEDB:Engine Type=4';
FConnection := CoConnection.Create;
FRecordset1 := CoRecordset.Create;
FRecordset1.Open('SELECT * FROM STOCKS,BARCODES Where BARCODES.S_CODE=STOCKS.CODE',FConnectString, adOpenKeyset, adLockOptimistic, adCmdText);
Screen.Cursor := crDefault;
end;