delphi转bcb ( 积分: 38 )

  • 主题发起人 主题发起人 BBM011
  • 开始时间 开始时间
B

BBM011

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.BitBtn1Click(Sender: TObject);
var
i:integer;
s1:tstringlist;
data_froms:string;
card_nos:string;
attend_dates,create_dates:string;
begin
s1:=tstringlist.Create ;
try
s1.LoadFromFile('RecvAll.txt');
progressbar1.Max:=s1.Count;
progressbar1.Position:=0;
for i:=0 to s1.Count-1do
begin
with ADOQuery1do
begin
data_froms:='007';
card_nos:=copy(s1,17,6);
attend_dates:=copy(s1,24,10)+' '+copy(s1,35,8);
close;
sql.Clear;
sql.Add('insert into sys_timecard values ('''+card_nos+''','''+attend_dates+''','''+data_froms+''',''1'',getdate())');
Edit1.Text:=sql.CommaText;
execsql;
end;
end;
except
//
end;
end;
 
procedure TForm1.BitBtn1Click(Sender: TObject);
var
i:integer;
s1:tstringlist;
data_froms:string;
card_nos:string;
attend_dates,create_dates:string;
begin
s1:=tstringlist.Create ;
try
s1.LoadFromFile('RecvAll.txt');
progressbar1.Max:=s1.Count;
progressbar1.Position:=0;
for i:=0 to s1.Count-1do
begin
with ADOQuery1do
begin
data_froms:='007';
card_nos:=copy(s1,17,6);
attend_dates:=copy(s1,24,10)+' '+copy(s1,35,8);
close;
sql.Clear;
sql.Add('insert into sys_timecard values ('''+card_nos+''','''+attend_dates+''','''+data_froms+''',''1'',getdate())');
Edit1.Text:=sql.CommaText;
execsql;
end;
end;
except
//
end;
end;
 
就是把他转为:C++ Builder
 
Delphi to C++Builder v1.5 注册码:ovmfSdsilo
http://www.thinkershome.com/d2c/index.htm
 
INT i;
STRING s1;
... ...
progressbar1->Max=s1->Count;
progressbar1->Position=0;
... ...
 
怎么没人啊, C++ builder copy 函数怎么用啊
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TStringList *s1 = new TStringList;
try
{
s1->LoadFromFile("RecvAll.txt");
ProgressBar1->Max = s1->Count;
ProgressBar1->Position = 0;
for (int i=0;s1->Count;i++)
{
AnsiString data_froms = '007';
AnsiString card_nos = s1->Strings.SubString(17,6);
AnsiString attend_dates = s1->Strings.SubString(24,10)+' '+s1->Strings.SubString(35,8);
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("insert into sys_timecard values ('"+card_nos+"','"+attend_dates+"','"+data_froms+"','1',getdate())");
Edit1->Text = ADOQuery1->SQL->CommaText;
ADOQuery1->ExecSQL();
}
}
catch (...){}
}
//---------------------------------------------------------------------------
 
copy(@,@,;;);
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TStringList *s1 = new TStringList;
try
{
s1->LoadFromFile("RecvAll.txt");
ProgressBar1->Max = s1->Count;
ProgressBar1->Position = 0;
for (int i=0;s1->Count;i++)
{
AnsiString data_froms = '007';
AnsiString card_nos = s1->Strings.SubString(17,6);
AnsiString attend_dates = s1->Strings.SubString(24,10)+' '+s1->Strings.SubString(35,8);
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("insert into sys_timecard values ('"+card_nos+"','"+attend_dates+"','"+data_froms+"','1',getdate())");
Edit1->Text = ADOQuery1->SQL->CommaText;
ADOQuery1->ExecSQL();
}
}
catch (...){}
delete s1;
}
 
后退
顶部