Okay, I discovered the solution to my problem. All I had to do was just
check the length of the dataProvider before doing an insert, if the
length of the arraycollection was 0(no entries) then it would amend the
insert statement to insert a zero into the primary key column. If the
length was anything but zero, it would insert the statement normally,
allowing the primary key column to increment normally. Here's the code I
used to do this:

providerLength = model.prodMaintData.length;
             if(providerLength == 0)
             {
                 sqlText = "INSERT INTO Up18Products(UniqueID, ProductID,
ProductName, Barcode, ReorderUnit, ReorderQty, Vendor, "
                      + "Cost, ListCost, Class, Billable, Status,
ToPrint, DateImported, DateUpdated," +
                     "RptQtyUsed, RptPercentUsed)" +
                     "VALUES(0, :productID, :productName, :Barcode,
:reorderUnit, :reorderQty, :Vendor, :Cost, :listCost, :Class," +
                     ":Billable, :Status, :toPrint, :dateImported,
:dateUpdated," +
                     ":rptQtyUsed, :rptPercentUsed)";
             }
             else
             {
             sqlText = "INSERT INTO Up18Products(ProductID, ProductName,
Barcode, ReorderUnit, ReorderQty, Vendor, " +
                     "Cost, ListCost, Class, Billable, Status, ToPrint,
DateImported, DateUpdated," +
                     "RptQtyUsed, RptPercentUsed)" +
                     "VALUES(:productID, :productName, :Barcode,
:reorderUnit, :reorderQty, :Vendor, :Cost, :listCost, :Class," +
                     ":Billable, :Status, :toPrint, :dateImported,
:dateUpdated," +
                     ":rptQtyUsed, :rptPercentUsed)";
             }

The rest you can probably guess. So far this seems to work perfectly, if
for any reason you don't think it will in the future, don't hesitate to
tell me.

Reply via email to