 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
James Peterson Guest
|
Posted: Fri May 07, 2004 3:13 pm Post subject: haveing problems.... again |
|
|
ok, I am moving data from a paradox database to a MS SQL database and I am
haveing a problem with this actually moveing the data. Query1 is the query
from the paradox database that combines 2 tables. ADOTable1 is the MS SQL
table.
here is my code. My question is,
1) is there a better way to transfer data. I can not use data migration
tools in MS SQL because I am will be reading in rtf files not currently in
the database, and will be changing some data types.
2) why does it give me the error
"Project convert.exe raised exception class EOleException with mesage
'[Micdrosoft][ODBC Server Driver][SQL Server] violation of primary key
constraint 'PK__specsheet__78BEDCC2. Can not insert duplicate key in object
'Specsheet".
The Table is deleted and recreated at runtime useing SQL statements, so
there shouldn't be any records in the database to begin with. yet when I
check there is always record in there with the ItemNumber as the primary key
set to '1' and the first record being imported is '10001'.
ADOTable1->TableName="Specsheet";
ADOTable1->Open();
Query1->Close();
Query1->SQL->Clear();
Query1->SQL->Add("select * from ItmCFG, specshts where ItmCFG.Itm_No =
specshts.ItmNo");
Query1->Open();
while(!Query1->Eof)
{
ADOTable1->Insert();
ADOTable1->FieldByName("ItemNumber")->AsString =
Query1->FieldByName("Itm_No")->Text;
ADOTable1->Post();
Query1->Next();
}
|
|
| Back to top |
|
 |
James Peterson Guest
|
Posted: Fri May 07, 2004 4:20 pm Post subject: Re: haveing problems.... again |
|
|
Never mind I answered my own question shortly after I posted this... guess
it helped me think about the problem...
"James Peterson" <jpeterson (AT) romanmealmilling (DOT) com> wrote
| Quote: | ok, I am moving data from a paradox database to a MS SQL database and I am
haveing a problem with this actually moveing the data. Query1 is the
query
from the paradox database that combines 2 tables. ADOTable1 is the MS SQL
table.
here is my code. My question is,
1) is there a better way to transfer data. I can not use data migration
tools in MS SQL because I am will be reading in rtf files not currently in
the database, and will be changing some data types.
2) why does it give me the error
"Project convert.exe raised exception class EOleException with mesage
'[Micdrosoft][ODBC Server Driver][SQL Server] violation of primary key
constraint 'PK__specsheet__78BEDCC2. Can not insert duplicate key in
object
'Specsheet".
The Table is deleted and recreated at runtime useing SQL statements, so
there shouldn't be any records in the database to begin with. yet when I
check there is always record in there with the ItemNumber as the primary
key
set to '1' and the first record being imported is '10001'.
ADOTable1->TableName="Specsheet";
ADOTable1->Open();
Query1->Close();
Query1->SQL->Clear();
Query1->SQL->Add("select * from ItmCFG, specshts where ItmCFG.Itm_No =
specshts.ItmNo");
Query1->Open();
while(!Query1->Eof)
{
ADOTable1->Insert();
ADOTable1->FieldByName("ItemNumber")->AsString =
Query1->FieldByName("Itm_No")->Text;
ADOTable1->Post();
Query1->Next();
}
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|