问题描述
嗨朋友们,
我正在寻找有关使用delphi 6将Firebird迁移到SQL Server 2008的帮助。我在firebird中有一个数据库Inventory,我在SQL中创建了它也。例如:我想从库存数据库(firebird到sql)迁移数据。表名是ASSETCATEGMAS,列是ACATID,CATCODE和ACATDESC。我想在BUTTON点击中执行此操作。我附上我写的部分代码实际上是错误的。我不是普通的Delphi用户,所以我在编码方面不是很完美。任何示例代码或帮助将不胜感激。
Hi Friends,
I am looking for a help regarding the migration of Firebird to SQL Server 2008 using delphi 6. I have a database "Inventory" in firebird and the same I have created in SQL also. For eg: I want to migrate the data from "Inventory" database (firebird to sql). The table name is "ASSETCATEGMAS" and columns "ACATID","CATCODE" and "ACATDESC". I want to do this with in a BUTTON click. I am enclosing the part of code I have written which is actually wrong. I am not a regular Delphi user so I am not much perfect in coding. Any example code or help will be appreciated.
procedure TForm1.Button1Click(Sender: TObject);
begin
SQLQuery1.Close;
SQLQuery1.SQL.Clear;
SQLQuery1.SQL.Add('Select * from ASSETCATEGMAS');
SQLQuery1.Open;
begin
SQLQuery1.First;
while not ADOQuery1.Eof do
begin
if not ADOTable1.Locate('ACATID',SQLQuery1.Fieldbyname('ACATID').AsInteger,[]) then
begin
SQLTable1.Append;
SQLTable1.FieldByName('ACATID').AsInteger:= ADOTable1.Fieldbyname('ACATID').AsInteger;
end
else
SQLTable1.Insert;
SQLTable1.FieldByName('CATCODE').AsString:=ADOTable1.Fieldbyname('CATCODE').AsString;
SQLTable1.FieldByName('ACATDESC').AsString:=ADOTable1.Fieldbyname('ACATDESC').AsString;
SQLTable1.Post;
SQLQuery1.Next;
inc(i);
end;
end;
showmessage(Inttostr(SQLQuery1.recordcount));
end;
推荐答案
这篇关于如何使用delphi将firebird数据迁移到sql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!