db to Txt export and import

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
rahim_azeri
Üye
Mesajlar: 113
Kayıt: 20 Eyl 2010 07:42

db to Txt export and import

Mesaj gönderen rahim_azeri »

Merhaba arkadaslar..Ben Accessden verileri delphi ile nasil txt-ye export ve import ede bilirim?
rahim_azeri
Üye
Mesajlar: 113
Kayıt: 20 Eyl 2010 07:42

Re: db to Txt export and import

Mesaj gönderen rahim_azeri »

Kardesler bu konuda bir bilen yokmu?
rahim_azeri
Üye
Mesajlar: 113
Kayıt: 20 Eyl 2010 07:42

Re: db to Txt export and import

Mesaj gönderen rahim_azeri »

Kardesler export etmeyi buldum kodu asaqidaki kim kimese lazim olar..... amma importu nasil yapim bilemiyorum lutfen yardim edim...!


Kod: Tümünü seç

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB;

type
  TForm1 = class(TForm)
    ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  f:text;
  f_c,r_c,i,n:integer;
  str:string;
  dump:string;
  a:array[1..100] of string;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
if not FileExists('DB_Dump.txt') then
begin
Rewrite (f,'DB_Dump.txt');
CloseFile(f);
end;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from oyunlar';
ADOQuery1.Open;
f_c:=ADOQuery1.FieldCount;
r_c:=ADOQuery1.RecordCount;
for n:=0 to r_c-1 do begin
for i:=0 to f_c-1 do
begin
dump:='';
a[i]:=ADOQuery1.Fields[i].AsString+'#';
AssignFile(f,'DB_Dump.txt');
Append(f);
Write (f,a[i]);
CloseFile(f);
end;
Append(f);
Writeln (f,'');
CloseFile(f);
ADOQuery1.Next;
end;
end;

end.
orhancc
Üye
Mesajlar: 585
Kayıt: 24 Ağu 2010 02:14
Konum: İstanbul / Kadıköy
İletişim:

Re: db to Txt export and import

Mesaj gönderen orhancc »

işlemin tersini yapacaksın readln ile tüm satırları tek tek okuyup gerekli alanlara atacaksın.
rahim_azeri
Üye
Mesajlar: 113
Kayıt: 20 Eyl 2010 07:42

Re: db to Txt export and import

Mesaj gönderen rahim_azeri »

Kardes ornek kodunu yazsan cok iyi olur...! Tesekkurler...
Cevapla