OLEDB SQL INSERT Statement too long?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Duff
    New Member
    • Sep 2007
    • 3

    OLEDB SQL INSERT Statement too long?

    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 @ItemFPartNumbe r) I tested this in the watch window while the code was running.

    How can I make this work?

    Code Sample (sorry, it's huge):

    Code:
     
    
     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)"
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    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

    Comment

    • aliasruel
      New Member
      • Sep 2007
      • 73

      #3
      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 (PurchaseOrderN umber, POIssueDate, SupplierName, SupplierAddress , SupplierCity, SupplerStateOrP rovince, SupplierZipOrPo stalCode, SupplierCountry , SupplierPhone, SupplierFax, ShipToName, ShipToAddress, ShipToCity, ShipToStateOrPr ovince, ShipToZipOrPost alCode, ShipToCountry, ShipToPhone, ShipToFax, SupplierQuoteNo , Terms, OriginatedBy, RequiredDate, ShipVia, ShippingTerms, FOBPoint, PSTExemptionNum ber, ReferenceNumber , ReferenceDescri ption, SubTotal, GST, PST, Total, SIMSDS, SIOutsourcedPro duction, SIIntercompanyT ransaction, SIConfirmationO nly, SIMaterialCerti fication, ApprovedBy, ItemDPartNumber , ItemDQuantity, ItemDDescriptio n, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemBPartNumber , ItemBQuantity, ItemBDescriptio n, ItemBUnit, ItemBUnitPrice, ItemBCurrency, ItemBExtension, ItemBGLCode, ItemCPartNumber , ItemCQuantity, ItemCDescriptio n, ItemCUnit, ItemCUnitPrice, ItemCCurrency, ItemCExtension, ItemCGLCode, ItemDPartNumber , ItemDQuantity, ItemDDescriptio n, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemEPartNumber , ItemEQuantity, ItemEDescriptio n, ItemEUnit, ItemEUnitPrice, ItemECurrency, ItemEExtension, ItemEGLCode,?? , ItemFPartNumber , ItemFQuantity, ItemFDescriptio n, ItemFUnit, ItemFUnitPrice, ItemFCurrency, ItemFExtension, ItemFGLCode, ItemGPartNumber , ItemGQuantity, ItemGDescriptio n, ItemGUnit, ItemGUnitPrice, ItemGCurrency, ItemGExtension, ItemGGLCode, ItemHPartNumber , ItemHQuantity, ItemHDescriptio n, ItemHUnit, ItemHUnitPrice, ItemHCurrency, ItemHExtension, ItemHGLCode, ItemIPartNumber , ItemIQuantity, ItemIDescriptio n, ItemIUnit, ItemIUnitPrice, ItemICurrency, ItemIExtension, ItemIGLCode, , ItemJPartNumber , ItemJQuantity, ItemJDescriptio n, ItemJUnit, ItemJUnitPrice, ItemJCurrency, ItemJExtension, ItemJGLCode, ItemKPartNumber , ItemKQuantity, ItemKDescriptio n, ItemKUnit, ItemKUnitPrice, ItemKCurrency, ItemKExtension, ItemKGLCode, ItemLPartNumber , ItemLQuantity, ItemLDescriptio n, ItemLUnit, ItemLUnitPrice, ItemLCurrency, ItemLExtension, ItemLGLCode, ItemMPartNumber , ItemMQuantity, ItemMDescriptio n, ItemMUnit, ItemMUnitPrice, ItemMCurrency, ItemMExtension, ItemMGLCode, ItemNPartNumber , ItemNQuantity, ItemNDescriptio n, ItemNUnit, ItemNUnitPrice, ItemNCurrency, ItemNExtension, ItemNGLCode, ItemOPartNumber , ItemOQuantity, ItemODescriptio n, ItemOUnit, ItemOUnitPrice, ItemOCurrency, ItemOExtension, ItemOGLCode, ItemPPartNumber , ItemPQuantity, ItemPDescriptio n, ItemPUnit, ItemPUnitPrice, ItemPCurrency, ItemPExtension, ItemPGLCode, ItemQPartNumber , ItemQQuantity, ItemQDescriptio n, ItemQUnit, ItemQUnitPrice, ItemQCurrency, ItemQExtension, ItemQGLCode, ItemRPartNumber , ItemRQuantity, ItemRDescriptio n, ItemRUnit, ItemRUnitPrice, ItemRCurrency, ItemRExtension, ItemRGLCode) VALUES (@PurchaseOrder Number, @POIssueDate, @SupplierName, @SupplierAddres s, @SupplierCity, @SupplerStateOr Province, @SupplierZipOrP ostalCode, @SupplierCountr y, @SupplierPhone, @SupplierFax, @ShipToName, @ShipToAddress, @ShipToCity, @ShipToStateOrP rovince, @ShipToZipOrPos talCode, @ShipToCountry, @ShipToPhone, @ShipToFax, @SupplierQuoteN o, @Terms, @OriginatedBy, @RequiredDate, @ShipVia, @ShippingTerms, @FOBPoint, @PSTExemptionNu mber, @ReferenceNumbe r, @ReferenceDescr iption, @SubTotal, @GST, @PST, @Total, @SIMSDS, @SIOutsourcedPr oduction, @SIIntercompany Transaction, @SIConfirmation Only, @SIMaterialCert ification, @ApprovedBy, @ItemDPartNumbe r, @ItemDQuantity, @ItemDDescripti on, @ItemDUnit, @ItemDUnitPrice , @ItemDCurrency, @ItemDExtension , @ItemDGLCode, @ItemBPartNumbe r, @ItemBQuantity, @ItemBDescripti on, @ItemBUnit, @ItemBUnitPrice , @ItemBCurrency, @ItemBExtension , @ItemBGLCode, @ItemCPartNumbe r, @ItemCQuantity, @ItemCDescripti on, @ItemCUnit, @ItemCUnitPrice , @ItemCCurrency, @ItemCExtension , @ItemCGLCode, @ItemDPartNumbe r, @ItemDQuantity, @ItemDDescripti on, @ItemDUnit, @ItemDUnitPrice , @ItemDCurrency, @ItemDExtension , @ItemDGLCode, @ItemEPartNumbe r, @ItemEQuantity, @ItemEDescripti on, @ItemEUnit, @ItemEUnitPrice , @ItemECurrency, @ItemEExtension , @ItemEGLCode, @ItemFPartNumbe r, @ItemFQuantity, @ItemFDescripti on, @ItemFUnit, @ItemFUnitPrice , @ItemFCurrency, @ItemFExtension , @ItemFGLCode, @ItemGPartNumbe r, @ItemGQuantity, @ItemGDescripti on, @ItemGUnit, @ItemGUnitPrice , @ItemGCurrency, @ItemGExtension , @ItemGGLCode, @ItemHPartNumbe r, @ItemHQuantity, @ItemHDescripti on, @ItemHUnit, @ItemHUnitPrice , @ItemHCurrency, @ItemHExtension , @ItemHGLCode, @ItemIPartNumbe r, @ItemIQuantity, @ItemIDescripti on, @ItemIUnit, @ItemIUnitPrice , @ItemICurrency, @ItemIExtension , @ItemIGLCode, @ItemJPartNumbe r, @ItemJQuantity, @ItemJDescripti on, @ItemJUnit, @ItemJUnitPrice , @ItemJCurrency, @ItemJExtension , @ItemJGLCode, @ItemKPartNumbe r, @ItemKQuantity, @ItemKDescripti on, @ItemKUnit, @ItemKUnitPrice , @ItemKCurrency, @ItemKExtension , @ItemKGLCode, @ItemLPartNumbe r, @ItemLQuantity, @ItemLDescripti on, @ItemLUnit, @ItemLUnitPrice , @ItemLCurrency, @ItemLExtension , @ItemLGLCode, @ItemMPartNumbe r, @ItemMQuantity, @ItemMDescripti on, @ItemMUnit, @ItemMUnitPrice , @ItemMCurrency, @ItemMExtension , @ItemMGLCode, @ItemNPartNumbe r, @ItemNQuantity, @ItemNDescripti on, @ItemNUnit, @ItemNUnitPrice , @ItemNCurrency, @ItemNExtension , @ItemNGLCode, @ItemOPartNumbe r, @ItemOQuantity, @ItemODescripti on, @ItemOUnit, @ItemOUnitPrice , @ItemOCurrency, @ItemOExtension , @ItemOGLCode, @ItemPPartNumbe r, @ItemPQuantity, @ItemPDescripti on, @ItemPUnit, @ItemPUnitPrice , @ItemPCurrency, @ItemPExtension , @ItemPGLCode, @ItemQPartNumbe r, @ItemQQuantity, @ItemQDescripti on, @ItemQUnit, @ItemQUnitPrice , @ItemQCurrency, @ItemQExtension , @ItemQGLCode, @ItemRPartNumbe r, @ItemRQuantity, @ItemRDescripti on, @ItemRUnit, @ItemRUnitPrice , @ItemRCurrency, @ItemRExtension , @ItemRGLCode)"





      =============== =============== =============== ===========

      Best Regards,
      Ruel






      Originally posted by Duff
      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 @ItemFPartNumbe r) I tested this in the watch window while the code was running.

      How can I make this work?

      Code Sample (sorry, it's huge):

      Code:
       
      
       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, [B]ItemEGLCode, , ItemFPartNumber,[/B] 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, [B]ItemIGLCode, , ItemJPartNumber[/B], 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)"

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        Good one aliasruel
        but then that shoud have thrown a syntax exception anyways.
        Seems u caught the fish
        cheers

        Comment

        • Duff
          New Member
          • Sep 2007
          • 3

          #5
          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?

          Originally posted by aliasruel
          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 (PurchaseOrderN umber, POIssueDate, SupplierName, SupplierAddress , SupplierCity, SupplerStateOrP rovince, SupplierZipOrPo stalCode, SupplierCountry , SupplierPhone, SupplierFax, ShipToName, ShipToAddress, ShipToCity, ShipToStateOrPr ovince, ShipToZipOrPost alCode, ShipToCountry, ShipToPhone, ShipToFax, SupplierQuoteNo , Terms, OriginatedBy, RequiredDate, ShipVia, ShippingTerms, FOBPoint, PSTExemptionNum ber, ReferenceNumber , ReferenceDescri ption, SubTotal, GST, PST, Total, SIMSDS, SIOutsourcedPro duction, SIIntercompanyT ransaction, SIConfirmationO nly, SIMaterialCerti fication, ApprovedBy, ItemDPartNumber , ItemDQuantity, ItemDDescriptio n, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemBPartNumber , ItemBQuantity, ItemBDescriptio n, ItemBUnit, ItemBUnitPrice, ItemBCurrency, ItemBExtension, ItemBGLCode, ItemCPartNumber , ItemCQuantity, ItemCDescriptio n, ItemCUnit, ItemCUnitPrice, ItemCCurrency, ItemCExtension, ItemCGLCode, ItemDPartNumber , ItemDQuantity, ItemDDescriptio n, ItemDUnit, ItemDUnitPrice, ItemDCurrency, ItemDExtension, ItemDGLCode, ItemEPartNumber , ItemEQuantity, ItemEDescriptio n, ItemEUnit, ItemEUnitPrice, ItemECurrency, ItemEExtension, ItemEGLCode,?? , ItemFPartNumber , ItemFQuantity, ItemFDescriptio n, ItemFUnit, ItemFUnitPrice, ItemFCurrency, ItemFExtension, ItemFGLCode, ItemGPartNumber , ItemGQuantity, ItemGDescriptio n, ItemGUnit, ItemGUnitPrice, ItemGCurrency, ItemGExtension, ItemGGLCode, ItemHPartNumber , ItemHQuantity, ItemHDescriptio n, ItemHUnit, ItemHUnitPrice, ItemHCurrency, ItemHExtension, ItemHGLCode, ItemIPartNumber , ItemIQuantity, ItemIDescriptio n, ItemIUnit, ItemIUnitPrice, ItemICurrency, ItemIExtension, ItemIGLCode, , ItemJPartNumber , ItemJQuantity, ItemJDescriptio n, ItemJUnit, ItemJUnitPrice, ItemJCurrency, ItemJExtension, ItemJGLCode, ItemKPartNumber , ItemKQuantity, ItemKDescriptio n, ItemKUnit, ItemKUnitPrice, ItemKCurrency, ItemKExtension, ItemKGLCode, ItemLPartNumber , ItemLQuantity, ItemLDescriptio n, ItemLUnit, ItemLUnitPrice, ItemLCurrency, ItemLExtension, ItemLGLCode, ItemMPartNumber , ItemMQuantity, ItemMDescriptio n, ItemMUnit, ItemMUnitPrice, ItemMCurrency, ItemMExtension, ItemMGLCode, ItemNPartNumber , ItemNQuantity, ItemNDescriptio n, ItemNUnit, ItemNUnitPrice, ItemNCurrency, ItemNExtension, ItemNGLCode, ItemOPartNumber , ItemOQuantity, ItemODescriptio n, ItemOUnit, ItemOUnitPrice, ItemOCurrency, ItemOExtension, ItemOGLCode, ItemPPartNumber , ItemPQuantity, ItemPDescriptio n, ItemPUnit, ItemPUnitPrice, ItemPCurrency, ItemPExtension, ItemPGLCode, ItemQPartNumber , ItemQQuantity, ItemQDescriptio n, ItemQUnit, ItemQUnitPrice, ItemQCurrency, ItemQExtension, ItemQGLCode, ItemRPartNumber , ItemRQuantity, ItemRDescriptio n, ItemRUnit, ItemRUnitPrice, ItemRCurrency, ItemRExtension, ItemRGLCode) VALUES (@PurchaseOrder Number, @POIssueDate, @SupplierName, @SupplierAddres s, @SupplierCity, @SupplerStateOr Province, @SupplierZipOrP ostalCode, @SupplierCountr y, @SupplierPhone, @SupplierFax, @ShipToName, @ShipToAddress, @ShipToCity, @ShipToStateOrP rovince, @ShipToZipOrPos talCode, @ShipToCountry, @ShipToPhone, @ShipToFax, @SupplierQuoteN o, @Terms, @OriginatedBy, @RequiredDate, @ShipVia, @ShippingTerms, @FOBPoint, @PSTExemptionNu mber, @ReferenceNumbe r, @ReferenceDescr iption, @SubTotal, @GST, @PST, @Total, @SIMSDS, @SIOutsourcedPr oduction, @SIIntercompany Transaction, @SIConfirmation Only, @SIMaterialCert ification, @ApprovedBy, @ItemDPartNumbe r, @ItemDQuantity, @ItemDDescripti on, @ItemDUnit, @ItemDUnitPrice , @ItemDCurrency, @ItemDExtension , @ItemDGLCode, @ItemBPartNumbe r, @ItemBQuantity, @ItemBDescripti on, @ItemBUnit, @ItemBUnitPrice , @ItemBCurrency, @ItemBExtension , @ItemBGLCode, @ItemCPartNumbe r, @ItemCQuantity, @ItemCDescripti on, @ItemCUnit, @ItemCUnitPrice , @ItemCCurrency, @ItemCExtension , @ItemCGLCode, @ItemDPartNumbe r, @ItemDQuantity, @ItemDDescripti on, @ItemDUnit, @ItemDUnitPrice , @ItemDCurrency, @ItemDExtension , @ItemDGLCode, @ItemEPartNumbe r, @ItemEQuantity, @ItemEDescripti on, @ItemEUnit, @ItemEUnitPrice , @ItemECurrency, @ItemEExtension , @ItemEGLCode, @ItemFPartNumbe r, @ItemFQuantity, @ItemFDescripti on, @ItemFUnit, @ItemFUnitPrice , @ItemFCurrency, @ItemFExtension , @ItemFGLCode, @ItemGPartNumbe r, @ItemGQuantity, @ItemGDescripti on, @ItemGUnit, @ItemGUnitPrice , @ItemGCurrency, @ItemGExtension , @ItemGGLCode, @ItemHPartNumbe r, @ItemHQuantity, @ItemHDescripti on, @ItemHUnit, @ItemHUnitPrice , @ItemHCurrency, @ItemHExtension , @ItemHGLCode, @ItemIPartNumbe r, @ItemIQuantity, @ItemIDescripti on, @ItemIUnit, @ItemIUnitPrice , @ItemICurrency, @ItemIExtension , @ItemIGLCode, @ItemJPartNumbe r, @ItemJQuantity, @ItemJDescripti on, @ItemJUnit, @ItemJUnitPrice , @ItemJCurrency, @ItemJExtension , @ItemJGLCode, @ItemKPartNumbe r, @ItemKQuantity, @ItemKDescripti on, @ItemKUnit, @ItemKUnitPrice , @ItemKCurrency, @ItemKExtension , @ItemKGLCode, @ItemLPartNumbe r, @ItemLQuantity, @ItemLDescripti on, @ItemLUnit, @ItemLUnitPrice , @ItemLCurrency, @ItemLExtension , @ItemLGLCode, @ItemMPartNumbe r, @ItemMQuantity, @ItemMDescripti on, @ItemMUnit, @ItemMUnitPrice , @ItemMCurrency, @ItemMExtension , @ItemMGLCode, @ItemNPartNumbe r, @ItemNQuantity, @ItemNDescripti on, @ItemNUnit, @ItemNUnitPrice , @ItemNCurrency, @ItemNExtension , @ItemNGLCode, @ItemOPartNumbe r, @ItemOQuantity, @ItemODescripti on, @ItemOUnit, @ItemOUnitPrice , @ItemOCurrency, @ItemOExtension , @ItemOGLCode, @ItemPPartNumbe r, @ItemPQuantity, @ItemPDescripti on, @ItemPUnit, @ItemPUnitPrice , @ItemPCurrency, @ItemPExtension , @ItemPGLCode, @ItemQPartNumbe r, @ItemQQuantity, @ItemQDescripti on, @ItemQUnit, @ItemQUnitPrice , @ItemQCurrency, @ItemQExtension , @ItemQGLCode, @ItemRPartNumbe r, @ItemRQuantity, @ItemRDescripti on, @ItemRUnit, @ItemRUnitPrice , @ItemRCurrency, @ItemRExtension , @ItemRGLCode)"





          =============== =============== =============== ===========

          Best Regards,
          Ruel

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            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?

            Comment

            • Duff
              New Member
              • Sep 2007
              • 3

              #7
              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!

              Comment

              Working...