Mark,
Thank you for your response. With 87 fields and 80,000 rows it will be
hard to give fully reproducible code,
but I think this will show that it is pretty straightforward.
It works for 1001 rows, then produces the exception. It worked without
an exception in Firebird
version 2.5 or 3. It did not have a transaction previously. When I
encountered the error
when I was reviving this code, I added the transaction to see if it
would help, but the error was the same.
First I show the script, then I show the code:
Begin Script for table:
/////////////////////////////////////////////////////////////////////
create table ZipCodeDataBus
(ZipId integer not
null /* 0 */
,ZipCode char(5) not
null /* 1 */
,PrimaryRecord char(1) default '' not
null /* 2. */
,Population integer default 0 not
null /* 3 .*/
,HouseholdsPerZipCode integer default 0 not
null /* 4 */
,WhitePopulation integer default 0 not
null /* 5 */
,BlackPopulation integer default 0
not null /* 6 */
,HispanicPopulation integer default 0 not
null /* 7 */
,AsianPopulation integer default 0 not
null /* 8 */
,HawaiianPopulation integer default 0 not
null /* 9 */
,IndianPopulation integer default 0 not
null /* 10 */
,OtherPopulation integer default 0 not
null /* 11 */
,MalePopulation integer default 0 not
null /* 12 */
,FemalePopulation integer default 0 not
null /* 13 */
,PersonsPerHousehold decimal(4, 2) default 0000.00 not
null /* 14 */
,AverageHouseValue integer default 0 not
null /* 15 */
...... 87 columns
,FinanceNumber varchar(6) default '' not
null /* 86 .*/
,UniqueZIPName varchar(1) default '' not
null /* 87 */
,constraint pkZipCodeDataBus_ZipId primary key (ZipId)
);
commit;
create index idxZip_City on ZipCodeDataBus(City);
create index idxZip_State on ZipCodeDataBus(State);
create index idxZip_AverageHouseValue on ZipCodeDataBus(AverageHouseValue);
create index idxZip_IncomePerHousehold on ZipCodeDataBus(IncomePerHousehold);
create index idxZip_AreaCode on ZipCodeDataBus(AreaCode);
create index idxZip_County on ZipCodeDataBus(County);
create index idxZip_GrowthIncreaseNumber on
ZipCodeDataBus(GrowthIncreaseNumber);
create generator ZipCodeDataBus_Gen;
set generator ZipCodeDataBus_Gen to 100000000;
commit;
set term !! ;
create trigger ZipCodeDataBus_Trg FOR ZipCodeDataBus
before insert as
begin
new.ZipId = gen_id(ZipCodeDataBus_Gen, 1);
end !!
set term ; !!
commit;
End Script for Table
/////////////////////////////////////////////////////////////////////
///////////// This code is in WebForms Page
/////////////////////////////////////////
I load a DataTable from a csv file, with 80,000 rows
Instantiate myRecordWrapper
Open the myRecordWrapper.connection
myRecordWrapper.Connection.BeginTransaction
Begin loop for each DataRow (80,000)
Load 87 fields into myRecordWrapper
Load FbParameters from RecordWrapper
Compose Parameterized query
call this function, passing connection and transaction
CreateTheRecord(sQuery, passedConnection, passedTransaction, parameters)
{
bool bSuccess = true;
try
{
FbCommand mySqlCommand = new FbCommand(sQuery, passedConnection,
passedTransaction);
foreach(FbParameter parameter in parameters)
{
mySqlCommand.Parameters.Add(parameter);
}
mySqlCommand.ExecuteNonQuery();
bSuccess = true;
}
catch(FbException Ex)
{
sbErrMsg.Append(Ex.Message);
sbErrMsg.Append(": Query: ");
sbErrMsg.Append(sQuery);
WriteLogAndAlert(sbErrMsg);
bSuccess = false;
}
return bSuccess;
}
//end CreateTheRecord(...)
back in the calling function:
if fail {end loop}
End loop
if fail, ROllback, Close
else if success, Commit, Close
///////////// end code section
//////////////////////////////////////////////////
The query insert is a simple direct insert with no nested queries or
anything tricky. I log the error,
and the fields all match. And I reviewed the 1001 inserted records in
the database, and they are all correct.
Thank you for your help
Kyle
> --
> You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
firebird-net-pro...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/firebird-net-provider/e2f6017e-33ce-4b22-a399-a9414348b3e8%40lawinegevaar.nl.