Begin and End transaction in Sql to be clubbed with two queries

  • Hi,

    I have a VB.NET application which is connected to SQL database. It is for a manufacturing company.

    I have made a Dispatch Form where multiple products can be sent in a single invoice. On click of submit button following SQL transactions take place:

    1) Sales.DispatchDatabase gets updated with DispatchID, CustomerName, Date, TotalInvoiceAmount

    2) Sales.DispatchedProducts gets updated with the same DispatchID and different Products and Quantities.

    3) Stock.StockDatabase gets updated accordingly.

    When I run the application, sometimes the code doesnt get executed fully, due to which the first two database gets updated but the stock database doesnt get updated. The stock calculation hence gets manipulated.

    I have read about Begin, End trans. Can I apply it over here.

    Or can anybody suggest a better foolproof way to do it?

    Thanks & Regards,

    Vaibhav

  • This is exactly why transactions are needed.

    Google is your friend (1st result from "VB.NET sqlserver transaction")

    http://articles.techrepublic.com.com/5100-10878_11-5766653.html



    Clear Sky SQL
    My Blog[/url]

  • Thanks Dave..

    I am not able to open the website. Dont know why..

    Can you please copy the entire stuff and email it to me at c.vaibhav@yahoo.com

    thanks alot!!!

    Regards,

    Vaibhav

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply