BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

haveing problems.... again

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
James Peterson
Guest





PostPosted: Fri May 07, 2004 3:13 pm    Post subject: haveing problems.... again Reply with 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
James Peterson
Guest





PostPosted: Fri May 07, 2004 4:20 pm    Post subject: Re: haveing problems.... again Reply with quote




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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.