VB 2008 - Record Locking

Discussion in 'Developers Forum' started by PCSG, Apr 26, 2011.

  1. PCSG New Member

    I have now developed a full VB 2008 application to fully integrate Customers & Sales / Suppliers & Purchases using a SQL 2005 Back End Database. It takes the data from our CRM system and some good old Excel Spreadsheets and send it through to Kashflow within minimal human intervention.

    All just working fine until yesterday. No cide has changed but I am receiving the following error when I try to Get the Supplier ID

    Code:
                uSupplier = uService.GetSupplier(sStatus, sStatusDetail, My.Settings.UserName, My.Settings.Password, uReader("SupplierID"))
    
    I have checked and double checked my UserID / Password and know they are correct as they are used in many other places.

    Error Msg.jpg

    If I carry on the next error thrown back in the status field is as below

    Has anyone got a suggestion
  2. DuaneJackson Administrator

    The error says "Transactions may be locked".

    HAve you gone to Settings -> Advanced Settings to check if transactions are locked?

    I'd guess you're trying to insert something dated before the lock date
  3. PCSG New Member

    Found Solution to Record Locking !

    I had checked the "other Setting" for record locking and this was not ticked so starting investigating my code again.

    This is my code:
    Code:
                ' Check for Existing Record
                uSupplier = uService.GetSupplier(sStatus, sStatusDetail, My.Settings.UserName, My.Settings.Password, uReader("SupplierID"))
    
    
                ' Define Purchase Header Transaction
                uTransaction.CustomerID = uSupplier.SupplierID
                uTransaction.InvoiceNumber = "000"
                uTransaction.InvoiceDate = uReader("PurchaseDate")
                uTransaction.DueDate = uReader("PurchaseDate")
                uTransaction.CustomerReference = uReader("PurchaseID")
    
                ' Write New Purchase Header Record
                iResultPurchase = uService.InsertReceipt(sStatus, sStatusDetail, My.Settings.UserName, My.Settings.Password, uTransaction)
    
    The issue is caused by the fact that the "friendly" SupplierID passed in the first line did not exist in Kashflow which mean't the real SupplierID passed to the Transaction Line was 0. I am now building in a check for a zero return value.

    What has come out is that the API is actually sending back an erroneous error message as this has nothing to do with an invalid User Name or Password or record locking - maybe one to provide to the developers for investigation when they are bored !!.
    Still a great API interface and so flexible.

    Cheers

    Angus

Share This Page