I'm trying to run the following code, but it keeps giving me a "Syntax error in INSERT INTO statement."
I found that my SQL Command string (sqlCmdPOCreate) is not getting the whole string (cuts it off at around @ItemFPartNumber) I tested this in the watch window while the code was running.
How can I make this work?
Code Sample (sorry, it's huge): -
-
-
sqlCmdPOCreate = "INSERT INTO PurchaseOrder (PurchaseOrderNumber, POIssueDate, SupplierName, SupplierAddress, SupplierCity, SupplerStateOrProvince, SupplierZipOrPostalCode, SupplierCountry, SupplierPhone, SupplierFax, ShipToName, ShipToAddress, ShipToCity, ShipToStateOrProvince, ShipToZipOrPostalCode, ShipToCountry, ShipToPhone, ShipToFax, SupplierQuoteNo, Terms, OriginatedBy, RequiredDate, ShipVia, ShippingTerms, FOBPoint, PSTExemptionNumber, ReferenceNumber, ReferenceDescription, SubTotal, GST, PST, Total, SIMSDS, SIOutsourcedProduction, SIIntercompanyTransaction, SIConfirmationOnly, SIMaterialCertification, ApprovedBy, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemBPartNumber, ItemBQuantity, ItemBDescription, ItemBUnit, ItemBUnitPrice, ItemBCurrency, ItemBExtension, ItemBGLCode, ItemCPartNumber, ItemCQuantity, ItemCDescription, ItemCUnit, ItemCUnitPrice, ItemCCurrency, ItemCExtension, ItemCGLCode, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemEPartNumber, ItemEQuantity, ItemEDescription, ItemEUnit, ItemEUnitPrice, ItemECurrency, ItemEExtension, ItemEGLCode, , ItemFPartNumber, ItemFQuantity, ItemFDescription, ItemFUnit, ItemFUnitPrice, ItemFCurrency, ItemFExtension, ItemFGLCode, ItemGPartNumber, ItemGQuantity, ItemGDescription, ItemGUnit, ItemGUnitPrice, ItemGCurrency, ItemGExtension, ItemGGLCode, ItemHPartNumber, ItemHQuantity, ItemHDescription, ItemHUnit, ItemHUnitPrice, ItemHCurrency, ItemHExtension, ItemHGLCode, ItemIPartNumber, ItemIQuantity, ItemIDescription, ItemIUnit, ItemIUnitPrice, ItemICurrency, ItemIExtension, ItemIGLCode, , ItemJPartNumber, ItemJQuantity, ItemJDescription, ItemJUnit, ItemJUnitPrice, ItemJCurrency, ItemJExtension, ItemJGLCode, ItemKPartNumber, ItemKQuantity, ItemKDescription, ItemKUnit, ItemKUnitPrice, ItemKCurrency, ItemKExtension, ItemKGLCode, ItemLPartNumber, ItemLQuantity, ItemLDescription, ItemLUnit, ItemLUnitPrice, ItemLCurrency, ItemLExtension, ItemLGLCode, ItemMPartNumber, ItemMQuantity, ItemMDescription, ItemMUnit, ItemMUnitPrice, ItemMCurrency, ItemMExtension, ItemMGLCode, ItemNPartNumber, ItemNQuantity, ItemNDescription, ItemNUnit, ItemNUnitPrice, ItemNCurrency, ItemNExtension, ItemNGLCode, ItemOPartNumber, ItemOQuantity, ItemODescription, ItemOUnit, ItemOUnitPrice, ItemOCurrency, ItemOExtension, ItemOGLCode, ItemPPartNumber, ItemPQuantity, ItemPDescription, ItemPUnit, ItemPUnitPrice, ItemPCurrency, ItemPExtension, ItemPGLCode, ItemQPartNumber, ItemQQuantity, ItemQDescription, ItemQUnit, ItemQUnitPrice, ItemQCurrency, ItemQExtension, ItemQGLCode, ItemRPartNumber, ItemRQuantity, ItemRDescription, ItemRUnit, ItemRUnitPrice, ItemRCurrency, ItemRExtension, ItemRGLCode) VALUES (@PurchaseOrderNumber, @POIssueDate, @SupplierName, @SupplierAddress, @SupplierCity, @SupplerStateOrProvince, @SupplierZipOrPostalCode, @SupplierCountry, @SupplierPhone, @SupplierFax, @ShipToName, @ShipToAddress, @ShipToCity, @ShipToStateOrProvince, @ShipToZipOrPostalCode, @ShipToCountry, @ShipToPhone, @ShipToFax, @SupplierQuoteNo, @Terms, @OriginatedBy, @RequiredDate, @ShipVia, @ShippingTerms, @FOBPoint, @PSTExemptionNumber, @ReferenceNumber, @ReferenceDescription, @SubTotal, @GST, @PST, @Total, @SIMSDS, @SIOutsourcedProduction, @SIIntercompanyTransaction, @SIConfirmationOnly, @SIMaterialCertification, @ApprovedBy, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemBPartNumber, @ItemBQuantity, @ItemBDescription, @ItemBUnit, @ItemBUnitPrice, @ItemBCurrency, @ItemBExtension, @ItemBGLCode, @ItemCPartNumber, @ItemCQuantity, @ItemCDescription, @ItemCUnit, @ItemCUnitPrice, @ItemCCurrency, @ItemCExtension, @ItemCGLCode, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemEPartNumber, @ItemEQuantity, @ItemEDescription, @ItemEUnit, @ItemEUnitPrice, @ItemECurrency, @ItemEExtension, @ItemEGLCode, @ItemFPartNumber, @ItemFQuantity, @ItemFDescription, @ItemFUnit, @ItemFUnitPrice, @ItemFCurrency, @ItemFExtension, @ItemFGLCode, @ItemGPartNumber, @ItemGQuantity, @ItemGDescription, @ItemGUnit, @ItemGUnitPrice, @ItemGCurrency, @ItemGExtension, @ItemGGLCode, @ItemHPartNumber, @ItemHQuantity, @ItemHDescription, @ItemHUnit, @ItemHUnitPrice, @ItemHCurrency, @ItemHExtension, @ItemHGLCode, @ItemIPartNumber, @ItemIQuantity, @ItemIDescription, @ItemIUnit, @ItemIUnitPrice, @ItemICurrency, @ItemIExtension, @ItemIGLCode, @ItemJPartNumber, @ItemJQuantity, @ItemJDescription, @ItemJUnit, @ItemJUnitPrice, @ItemJCurrency, @ItemJExtension, @ItemJGLCode, @ItemKPartNumber, @ItemKQuantity, @ItemKDescription, @ItemKUnit, @ItemKUnitPrice, @ItemKCurrency, @ItemKExtension, @ItemKGLCode, @ItemLPartNumber, @ItemLQuantity, @ItemLDescription, @ItemLUnit, @ItemLUnitPrice, @ItemLCurrency, @ItemLExtension, @ItemLGLCode, @ItemMPartNumber, @ItemMQuantity, @ItemMDescription, @ItemMUnit, @ItemMUnitPrice, @ItemMCurrency, @ItemMExtension, @ItemMGLCode, @ItemNPartNumber, @ItemNQuantity, @ItemNDescription, @ItemNUnit, @ItemNUnitPrice, @ItemNCurrency, @ItemNExtension, @ItemNGLCode, @ItemOPartNumber, @ItemOQuantity, @ItemODescription, @ItemOUnit, @ItemOUnitPrice, @ItemOCurrency, @ItemOExtension, @ItemOGLCode, @ItemPPartNumber, @ItemPQuantity, @ItemPDescription, @ItemPUnit, @ItemPUnitPrice, @ItemPCurrency, @ItemPExtension, @ItemPGLCode, @ItemQPartNumber, @ItemQQuantity, @ItemQDescription, @ItemQUnit, @ItemQUnitPrice, @ItemQCurrency, @ItemQExtension, @ItemQGLCode, @ItemRPartNumber, @ItemRQuantity, @ItemRDescription, @ItemRUnit, @ItemRUnitPrice, @ItemRCurrency, @ItemRExtension, @ItemRGLCode)"
-
-
6 1189
Has it been throwing any exceptions?
I tried to reproduce the situation using oleDbCommand, (as well as sql command though its not applicable) but my watch window captures the entire text.
cheers
Hi Duff,
i read the value of your sqlCmdPOCreate.. please look on the highlighted part.
then compare it to the original value? ================================================== ======
sqlCmdPOCreate = "INSERT INTO PurchaseOrder (PurchaseOrderNumber, POIssueDate, SupplierName, SupplierAddress, SupplierCity, SupplerStateOrProvince, SupplierZipOrPostalCode, SupplierCountry, SupplierPhone, SupplierFax, ShipToName, ShipToAddress, ShipToCity, ShipToStateOrProvince, ShipToZipOrPostalCode, ShipToCountry, ShipToPhone, ShipToFax, SupplierQuoteNo, Terms, OriginatedBy, RequiredDate, ShipVia, ShippingTerms, FOBPoint, PSTExemptionNumber, ReferenceNumber, ReferenceDescription, SubTotal, GST, PST, Total, SIMSDS, SIOutsourcedProduction, SIIntercompanyTransaction, SIConfirmationOnly, SIMaterialCertification, ApprovedBy, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemBPartNumber, ItemBQuantity, ItemBDescription, ItemBUnit, ItemBUnitPrice, ItemBCurrency, ItemBExtension, ItemBGLCode, ItemCPartNumber, ItemCQuantity, ItemCDescription, ItemCUnit, ItemCUnitPrice, ItemCCurrency, ItemCExtension, ItemCGLCode, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemEPartNumber, ItemEQuantity, ItemEDescription, ItemEUnit, ItemEUnitPrice, ItemECurrency, ItemEExtension, ItemEGLCode,?? , ItemFPartNumber, ItemFQuantity, ItemFDescription, ItemFUnit, ItemFUnitPrice, ItemFCurrency, ItemFExtension, ItemFGLCode, ItemGPartNumber, ItemGQuantity, ItemGDescription, ItemGUnit, ItemGUnitPrice, ItemGCurrency, ItemGExtension, ItemGGLCode, ItemHPartNumber, ItemHQuantity, ItemHDescription, ItemHUnit, ItemHUnitPrice, ItemHCurrency, ItemHExtension, ItemHGLCode, ItemIPartNumber, ItemIQuantity, ItemIDescription, ItemIUnit, ItemIUnitPrice, ItemICurrency, ItemIExtension, ItemIGLCode, , ItemJPartNumber, ItemJQuantity, ItemJDescription, ItemJUnit, ItemJUnitPrice, ItemJCurrency, ItemJExtension, ItemJGLCode, ItemKPartNumber, ItemKQuantity, ItemKDescription, ItemKUnit, ItemKUnitPrice, ItemKCurrency, ItemKExtension, ItemKGLCode, ItemLPartNumber, ItemLQuantity, ItemLDescription, ItemLUnit, ItemLUnitPrice, ItemLCurrency, ItemLExtension, ItemLGLCode, ItemMPartNumber, ItemMQuantity, ItemMDescription, ItemMUnit, ItemMUnitPrice, ItemMCurrency, ItemMExtension, ItemMGLCode, ItemNPartNumber, ItemNQuantity, ItemNDescription, ItemNUnit, ItemNUnitPrice, ItemNCurrency, ItemNExtension, ItemNGLCode, ItemOPartNumber, ItemOQuantity, ItemODescription, ItemOUnit, ItemOUnitPrice, ItemOCurrency, ItemOExtension, ItemOGLCode, ItemPPartNumber, ItemPQuantity, ItemPDescription, ItemPUnit, ItemPUnitPrice, ItemPCurrency, ItemPExtension, ItemPGLCode, ItemQPartNumber, ItemQQuantity, ItemQDescription, ItemQUnit, ItemQUnitPrice, ItemQCurrency, ItemQExtension, ItemQGLCode, ItemRPartNumber, ItemRQuantity, ItemRDescription, ItemRUnit, ItemRUnitPrice, ItemRCurrency, ItemRExtension, ItemRGLCode) VALUES (@PurchaseOrderNumber, @POIssueDate, @SupplierName, @SupplierAddress, @SupplierCity, @SupplerStateOrProvince, @SupplierZipOrPostalCode, @SupplierCountry, @SupplierPhone, @SupplierFax, @ShipToName, @ShipToAddress, @ShipToCity, @ShipToStateOrProvince, @ShipToZipOrPostalCode, @ShipToCountry, @ShipToPhone, @ShipToFax, @SupplierQuoteNo, @Terms, @OriginatedBy, @RequiredDate, @ShipVia, @ShippingTerms, @FOBPoint, @PSTExemptionNumber, @ReferenceNumber, @ReferenceDescription, @SubTotal, @GST, @PST, @Total, @SIMSDS, @SIOutsourcedProduction, @SIIntercompanyTransaction, @SIConfirmationOnly, @SIMaterialCertification, @ApprovedBy, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemBPartNumber, @ItemBQuantity, @ItemBDescription, @ItemBUnit, @ItemBUnitPrice, @ItemBCurrency, @ItemBExtension, @ItemBGLCode, @ItemCPartNumber, @ItemCQuantity, @ItemCDescription, @ItemCUnit, @ItemCUnitPrice, @ItemCCurrency, @ItemCExtension, @ItemCGLCode, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemEPartNumber, @ItemEQuantity, @ItemEDescription, @ItemEUnit, @ItemEUnitPrice, @ItemECurrency, @ItemEExtension, @ItemEGLCode, @ItemFPartNumber, @ItemFQuantity, @ItemFDescription, @ItemFUnit, @ItemFUnitPrice, @ItemFCurrency, @ItemFExtension, @ItemFGLCode, @ItemGPartNumber, @ItemGQuantity, @ItemGDescription, @ItemGUnit, @ItemGUnitPrice, @ItemGCurrency, @ItemGExtension, @ItemGGLCode, @ItemHPartNumber, @ItemHQuantity, @ItemHDescription, @ItemHUnit, @ItemHUnitPrice, @ItemHCurrency, @ItemHExtension, @ItemHGLCode, @ItemIPartNumber, @ItemIQuantity, @ItemIDescription, @ItemIUnit, @ItemIUnitPrice, @ItemICurrency, @ItemIExtension, @ItemIGLCode, @ItemJPartNumber, @ItemJQuantity, @ItemJDescription, @ItemJUnit, @ItemJUnitPrice, @ItemJCurrency, @ItemJExtension, @ItemJGLCode, @ItemKPartNumber, @ItemKQuantity, @ItemKDescription, @ItemKUnit, @ItemKUnitPrice, @ItemKCurrency, @ItemKExtension, @ItemKGLCode, @ItemLPartNumber, @ItemLQuantity, @ItemLDescription, @ItemLUnit, @ItemLUnitPrice, @ItemLCurrency, @ItemLExtension, @ItemLGLCode, @ItemMPartNumber, @ItemMQuantity, @ItemMDescription, @ItemMUnit, @ItemMUnitPrice, @ItemMCurrency, @ItemMExtension, @ItemMGLCode, @ItemNPartNumber, @ItemNQuantity, @ItemNDescription, @ItemNUnit, @ItemNUnitPrice, @ItemNCurrency, @ItemNExtension, @ItemNGLCode, @ItemOPartNumber, @ItemOQuantity, @ItemODescription, @ItemOUnit, @ItemOUnitPrice, @ItemOCurrency, @ItemOExtension, @ItemOGLCode, @ItemPPartNumber, @ItemPQuantity, @ItemPDescription, @ItemPUnit, @ItemPUnitPrice, @ItemPCurrency, @ItemPExtension, @ItemPGLCode, @ItemQPartNumber, @ItemQQuantity, @ItemQDescription, @ItemQUnit, @ItemQUnitPrice, @ItemQCurrency, @ItemQExtension, @ItemQGLCode, @ItemRPartNumber, @ItemRQuantity, @ItemRDescription, @ItemRUnit, @ItemRUnitPrice, @ItemRCurrency, @ItemRExtension, @ItemRGLCode)"
================================================== ======
Best Regards,
Ruel
I'm trying to run the following code, but it keeps giving me a "Syntax error in INSERT INTO statement."
I found that my SQL Command string (sqlCmdPOCreate) is not getting the whole string (cuts it off at around @ItemFPartNumber) I tested this in the watch window while the code was running.
How can I make this work?
Code Sample (sorry, it's huge): -
-
-
sqlCmdPOCreate = "INSERT INTO PurchaseOrder (PurchaseOrderNumber, POIssueDate, SupplierName, SupplierAddress, SupplierCity, SupplerStateOrProvince, SupplierZipOrPostalCode, SupplierCountry, SupplierPhone, SupplierFax, ShipToName, ShipToAddress, ShipToCity, ShipToStateOrProvince, ShipToZipOrPostalCode, ShipToCountry, ShipToPhone, ShipToFax, SupplierQuoteNo, Terms, OriginatedBy, RequiredDate, ShipVia, ShippingTerms, FOBPoint, PSTExemptionNumber, ReferenceNumber, ReferenceDescription, SubTotal, GST, PST, Total, SIMSDS, SIOutsourcedProduction, SIIntercompanyTransaction, SIConfirmationOnly, SIMaterialCertification, ApprovedBy, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemBPartNumber, ItemBQuantity, ItemBDescription, ItemBUnit, ItemBUnitPrice, ItemBCurrency, ItemBExtension, ItemBGLCode, ItemCPartNumber, ItemCQuantity, ItemCDescription, ItemCUnit, ItemCUnitPrice, ItemCCurrency, ItemCExtension, ItemCGLCode, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemEPartNumber, ItemEQuantity, ItemEDescription, ItemEUnit, ItemEUnitPrice, ItemECurrency, ItemEExtension, ItemEGLCode, , ItemFPartNumber, ItemFQuantity, ItemFDescription, ItemFUnit, ItemFUnitPrice, ItemFCurrency, ItemFExtension, ItemFGLCode, ItemGPartNumber, ItemGQuantity, ItemGDescription, ItemGUnit, ItemGUnitPrice, ItemGCurrency, ItemGExtension, ItemGGLCode, ItemHPartNumber, ItemHQuantity, ItemHDescription, ItemHUnit, ItemHUnitPrice, ItemHCurrency, ItemHExtension, ItemHGLCode, ItemIPartNumber, ItemIQuantity, ItemIDescription, ItemIUnit, ItemIUnitPrice, ItemICurrency, ItemIExtension, ItemIGLCode, , ItemJPartNumber, ItemJQuantity, ItemJDescription, ItemJUnit, ItemJUnitPrice, ItemJCurrency, ItemJExtension, ItemJGLCode, ItemKPartNumber, ItemKQuantity, ItemKDescription, ItemKUnit, ItemKUnitPrice, ItemKCurrency, ItemKExtension, ItemKGLCode, ItemLPartNumber, ItemLQuantity, ItemLDescription, ItemLUnit, ItemLUnitPrice, ItemLCurrency, ItemLExtension, ItemLGLCode, ItemMPartNumber, ItemMQuantity, ItemMDescription, ItemMUnit, ItemMUnitPrice, ItemMCurrency, ItemMExtension, ItemMGLCode, ItemNPartNumber, ItemNQuantity, ItemNDescription, ItemNUnit, ItemNUnitPrice, ItemNCurrency, ItemNExtension, ItemNGLCode, ItemOPartNumber, ItemOQuantity, ItemODescription, ItemOUnit, ItemOUnitPrice, ItemOCurrency, ItemOExtension, ItemOGLCode, ItemPPartNumber, ItemPQuantity, ItemPDescription, ItemPUnit, ItemPUnitPrice, ItemPCurrency, ItemPExtension, ItemPGLCode, ItemQPartNumber, ItemQQuantity, ItemQDescription, ItemQUnit, ItemQUnitPrice, ItemQCurrency, ItemQExtension, ItemQGLCode, ItemRPartNumber, ItemRQuantity, ItemRDescription, ItemRUnit, ItemRUnitPrice, ItemRCurrency, ItemRExtension, ItemRGLCode) VALUES (@PurchaseOrderNumber, @POIssueDate, @SupplierName, @SupplierAddress, @SupplierCity, @SupplerStateOrProvince, @SupplierZipOrPostalCode, @SupplierCountry, @SupplierPhone, @SupplierFax, @ShipToName, @ShipToAddress, @ShipToCity, @ShipToStateOrProvince, @ShipToZipOrPostalCode, @ShipToCountry, @ShipToPhone, @ShipToFax, @SupplierQuoteNo, @Terms, @OriginatedBy, @RequiredDate, @ShipVia, @ShippingTerms, @FOBPoint, @PSTExemptionNumber, @ReferenceNumber, @ReferenceDescription, @SubTotal, @GST, @PST, @Total, @SIMSDS, @SIOutsourcedProduction, @SIIntercompanyTransaction, @SIConfirmationOnly, @SIMaterialCertification, @ApprovedBy, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemBPartNumber, @ItemBQuantity, @ItemBDescription, @ItemBUnit, @ItemBUnitPrice, @ItemBCurrency, @ItemBExtension, @ItemBGLCode, @ItemCPartNumber, @ItemCQuantity, @ItemCDescription, @ItemCUnit, @ItemCUnitPrice, @ItemCCurrency, @ItemCExtension, @ItemCGLCode, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemEPartNumber, @ItemEQuantity, @ItemEDescription, @ItemEUnit, @ItemEUnitPrice, @ItemECurrency, @ItemEExtension, @ItemEGLCode, @ItemFPartNumber, @ItemFQuantity, @ItemFDescription, @ItemFUnit, @ItemFUnitPrice, @ItemFCurrency, @ItemFExtension, @ItemFGLCode, @ItemGPartNumber, @ItemGQuantity, @ItemGDescription, @ItemGUnit, @ItemGUnitPrice, @ItemGCurrency, @ItemGExtension, @ItemGGLCode, @ItemHPartNumber, @ItemHQuantity, @ItemHDescription, @ItemHUnit, @ItemHUnitPrice, @ItemHCurrency, @ItemHExtension, @ItemHGLCode, @ItemIPartNumber, @ItemIQuantity, @ItemIDescription, @ItemIUnit, @ItemIUnitPrice, @ItemICurrency, @ItemIExtension, @ItemIGLCode, @ItemJPartNumber, @ItemJQuantity, @ItemJDescription, @ItemJUnit, @ItemJUnitPrice, @ItemJCurrency, @ItemJExtension, @ItemJGLCode, @ItemKPartNumber, @ItemKQuantity, @ItemKDescription, @ItemKUnit, @ItemKUnitPrice, @ItemKCurrency, @ItemKExtension, @ItemKGLCode, @ItemLPartNumber, @ItemLQuantity, @ItemLDescription, @ItemLUnit, @ItemLUnitPrice, @ItemLCurrency, @ItemLExtension, @ItemLGLCode, @ItemMPartNumber, @ItemMQuantity, @ItemMDescription, @ItemMUnit, @ItemMUnitPrice, @ItemMCurrency, @ItemMExtension, @ItemMGLCode, @ItemNPartNumber, @ItemNQuantity, @ItemNDescription, @ItemNUnit, @ItemNUnitPrice, @ItemNCurrency, @ItemNExtension, @ItemNGLCode, @ItemOPartNumber, @ItemOQuantity, @ItemODescription, @ItemOUnit, @ItemOUnitPrice, @ItemOCurrency, @ItemOExtension, @ItemOGLCode, @ItemPPartNumber, @ItemPQuantity, @ItemPDescription, @ItemPUnit, @ItemPUnitPrice, @ItemPCurrency, @ItemPExtension, @ItemPGLCode, @ItemQPartNumber, @ItemQQuantity, @ItemQDescription, @ItemQUnit, @ItemQUnitPrice, @ItemQCurrency, @ItemQExtension, @ItemQGLCode, @ItemRPartNumber, @ItemRQuantity, @ItemRDescription, @ItemRUnit, @ItemRUnitPrice, @ItemRCurrency, @ItemRExtension, @ItemRGLCode)"
-
-
Good one aliasruel
but then that shoud have thrown a syntax exception anyways.
Seems u caught the fish
cheers
Good eye, I missed those two. I fixed those two errors but I'm still getting a "Syntax error in INSERT INTO statement" message when I run the executeNonQuery().
I've setup the watch window to watch the sqlCmdPOCreate string, but the string has everything up to @ItemFQua and then the string ends. I also did a check on the lenght and it's 5744. I haven't counted the characters yet, but I believe that for some reason the string is being cut off and I don't know why.
Is there an easier way of doing this? Or am I doing it the right way, it's just a pain?
Hi Duff,
i read the value of your sqlCmdPOCreate.. please look on the highlighted part.
then compare it to the original value? ================================================== ======
sqlCmdPOCreate = "INSERT INTO PurchaseOrder (PurchaseOrderNumber, POIssueDate, SupplierName, SupplierAddress, SupplierCity, SupplerStateOrProvince, SupplierZipOrPostalCode, SupplierCountry, SupplierPhone, SupplierFax, ShipToName, ShipToAddress, ShipToCity, ShipToStateOrProvince, ShipToZipOrPostalCode, ShipToCountry, ShipToPhone, ShipToFax, SupplierQuoteNo, Terms, OriginatedBy, RequiredDate, ShipVia, ShippingTerms, FOBPoint, PSTExemptionNumber, ReferenceNumber, ReferenceDescription, SubTotal, GST, PST, Total, SIMSDS, SIOutsourcedProduction, SIIntercompanyTransaction, SIConfirmationOnly, SIMaterialCertification, ApprovedBy, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemBPartNumber, ItemBQuantity, ItemBDescription, ItemBUnit, ItemBUnitPrice, ItemBCurrency, ItemBExtension, ItemBGLCode, ItemCPartNumber, ItemCQuantity, ItemCDescription, ItemCUnit, ItemCUnitPrice, ItemCCurrency, ItemCExtension, ItemCGLCode, ItemDPartNumber, ItemDQuantity, ItemDDescription, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemEPartNumber, ItemEQuantity, ItemEDescription, ItemEUnit, ItemEUnitPrice, ItemECurrency, ItemEExtension, ItemEGLCode,?? , ItemFPartNumber, ItemFQuantity, ItemFDescription, ItemFUnit, ItemFUnitPrice, ItemFCurrency, ItemFExtension, ItemFGLCode, ItemGPartNumber, ItemGQuantity, ItemGDescription, ItemGUnit, ItemGUnitPrice, ItemGCurrency, ItemGExtension, ItemGGLCode, ItemHPartNumber, ItemHQuantity, ItemHDescription, ItemHUnit, ItemHUnitPrice, ItemHCurrency, ItemHExtension, ItemHGLCode, ItemIPartNumber, ItemIQuantity, ItemIDescription, ItemIUnit, ItemIUnitPrice, ItemICurrency, ItemIExtension, ItemIGLCode, , ItemJPartNumber, ItemJQuantity, ItemJDescription, ItemJUnit, ItemJUnitPrice, ItemJCurrency, ItemJExtension, ItemJGLCode, ItemKPartNumber, ItemKQuantity, ItemKDescription, ItemKUnit, ItemKUnitPrice, ItemKCurrency, ItemKExtension, ItemKGLCode, ItemLPartNumber, ItemLQuantity, ItemLDescription, ItemLUnit, ItemLUnitPrice, ItemLCurrency, ItemLExtension, ItemLGLCode, ItemMPartNumber, ItemMQuantity, ItemMDescription, ItemMUnit, ItemMUnitPrice, ItemMCurrency, ItemMExtension, ItemMGLCode, ItemNPartNumber, ItemNQuantity, ItemNDescription, ItemNUnit, ItemNUnitPrice, ItemNCurrency, ItemNExtension, ItemNGLCode, ItemOPartNumber, ItemOQuantity, ItemODescription, ItemOUnit, ItemOUnitPrice, ItemOCurrency, ItemOExtension, ItemOGLCode, ItemPPartNumber, ItemPQuantity, ItemPDescription, ItemPUnit, ItemPUnitPrice, ItemPCurrency, ItemPExtension, ItemPGLCode, ItemQPartNumber, ItemQQuantity, ItemQDescription, ItemQUnit, ItemQUnitPrice, ItemQCurrency, ItemQExtension, ItemQGLCode, ItemRPartNumber, ItemRQuantity, ItemRDescription, ItemRUnit, ItemRUnitPrice, ItemRCurrency, ItemRExtension, ItemRGLCode) VALUES (@PurchaseOrderNumber, @POIssueDate, @SupplierName, @SupplierAddress, @SupplierCity, @SupplerStateOrProvince, @SupplierZipOrPostalCode, @SupplierCountry, @SupplierPhone, @SupplierFax, @ShipToName, @ShipToAddress, @ShipToCity, @ShipToStateOrProvince, @ShipToZipOrPostalCode, @ShipToCountry, @ShipToPhone, @ShipToFax, @SupplierQuoteNo, @Terms, @OriginatedBy, @RequiredDate, @ShipVia, @ShippingTerms, @FOBPoint, @PSTExemptionNumber, @ReferenceNumber, @ReferenceDescription, @SubTotal, @GST, @PST, @Total, @SIMSDS, @SIOutsourcedProduction, @SIIntercompanyTransaction, @SIConfirmationOnly, @SIMaterialCertification, @ApprovedBy, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemBPartNumber, @ItemBQuantity, @ItemBDescription, @ItemBUnit, @ItemBUnitPrice, @ItemBCurrency, @ItemBExtension, @ItemBGLCode, @ItemCPartNumber, @ItemCQuantity, @ItemCDescription, @ItemCUnit, @ItemCUnitPrice, @ItemCCurrency, @ItemCExtension, @ItemCGLCode, @ItemDPartNumber, @ItemDQuantity, @ItemDDescription, @ItemDUnit, @ItemDUnitPrice, @ItemDCurrency, @ItemDExtension, @ItemDGLCode, @ItemEPartNumber, @ItemEQuantity, @ItemEDescription, @ItemEUnit, @ItemEUnitPrice, @ItemECurrency, @ItemEExtension, @ItemEGLCode, @ItemFPartNumber, @ItemFQuantity, @ItemFDescription, @ItemFUnit, @ItemFUnitPrice, @ItemFCurrency, @ItemFExtension, @ItemFGLCode, @ItemGPartNumber, @ItemGQuantity, @ItemGDescription, @ItemGUnit, @ItemGUnitPrice, @ItemGCurrency, @ItemGExtension, @ItemGGLCode, @ItemHPartNumber, @ItemHQuantity, @ItemHDescription, @ItemHUnit, @ItemHUnitPrice, @ItemHCurrency, @ItemHExtension, @ItemHGLCode, @ItemIPartNumber, @ItemIQuantity, @ItemIDescription, @ItemIUnit, @ItemIUnitPrice, @ItemICurrency, @ItemIExtension, @ItemIGLCode, @ItemJPartNumber, @ItemJQuantity, @ItemJDescription, @ItemJUnit, @ItemJUnitPrice, @ItemJCurrency, @ItemJExtension, @ItemJGLCode, @ItemKPartNumber, @ItemKQuantity, @ItemKDescription, @ItemKUnit, @ItemKUnitPrice, @ItemKCurrency, @ItemKExtension, @ItemKGLCode, @ItemLPartNumber, @ItemLQuantity, @ItemLDescription, @ItemLUnit, @ItemLUnitPrice, @ItemLCurrency, @ItemLExtension, @ItemLGLCode, @ItemMPartNumber, @ItemMQuantity, @ItemMDescription, @ItemMUnit, @ItemMUnitPrice, @ItemMCurrency, @ItemMExtension, @ItemMGLCode, @ItemNPartNumber, @ItemNQuantity, @ItemNDescription, @ItemNUnit, @ItemNUnitPrice, @ItemNCurrency, @ItemNExtension, @ItemNGLCode, @ItemOPartNumber, @ItemOQuantity, @ItemODescription, @ItemOUnit, @ItemOUnitPrice, @ItemOCurrency, @ItemOExtension, @ItemOGLCode, @ItemPPartNumber, @ItemPQuantity, @ItemPDescription, @ItemPUnit, @ItemPUnitPrice, @ItemPCurrency, @ItemPExtension, @ItemPGLCode, @ItemQPartNumber, @ItemQQuantity, @ItemQDescription, @ItemQUnit, @ItemQUnitPrice, @ItemQCurrency, @ItemQExtension, @ItemQGLCode, @ItemRPartNumber, @ItemRQuantity, @ItemRDescription, @ItemRUnit, @ItemRUnitPrice, @ItemRCurrency, @ItemRExtension, @ItemRGLCode)"
================================================== ======
Best Regards,
Ruel
If it's an SQL database (and probably other types also) you could try creating a stored procedure withen the database itself. Then you could just create an SQLCommand and add the attributes to it, it should make your in-program string much shorter?
A test might be to make a dummy texbox and put the result of your SQL string into it.
Then copy/paste it into an SQL window (again, I am talking sql server so you would use SQL server management studio or something similar) and see what errors it gives.
Are you remembering to set values for all of those @ varriables?
Thanks for all your help! I was worried that it was too long or something.
I found that I had a couple of syntax errors and once that was fixed, I'm good to go!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Robert Hanson |
last post by:
Hi All,
I am trying to add a record to a datatable that is connected to an Access
database. I had no trouble with string and date fields, but for this
record, I have two Long Integer field...
|
by: Brian Henry |
last post by:
I have an access database, and one of the fields in the table I am inserting
into has a date/time data type. What is the correct OleDb data type to
insert the date and time that it is at the moment...
|
by: Brian Henry |
last post by:
I have an access database, and one of the fields in the table I am inserting
into has a date/time data type. What is the correct OleDb data type to
insert the date and time that it is at the moment...
|
by: Brian Henry |
last post by:
I have an access database, and one of the fields in the table I am inserting
into has a date/time data type. What is the correct OleDb data type to
insert the date and time that it is at the moment...
|
by: Joe |
last post by:
Hello All,
I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message,
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |