Skip to content

How to read all 4 the sql command?

King Umar

King Umar

Asked Jul 9, 2015, 7:02 PM EDTSolved
Share
LinkedInX
When i click the button only the two first sql command are working and the third and fourth command are not working,can anyone help guys? i'm using visual studio 2013 (vb.net) and sql server 2012

             

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Manoj Bhoir
    ✓ Accepted answer+2
    Hi,
     
    While Inserting and Deleting why you are using ExecuteReader.
    Just use ExecuteNonQuery which will give you Number of Rows affected.
    Try to debug your code and check when your second Insert command execute on Database what value you are getting in your READERRR variable. It may be null. You are using (If READERR.Read()  Then) if READERR is null your condition return false and it will not execute other two queries.
     
    Simply use ExecuteNonquery and check if number of rows affected is greater thatn 0 then execute next query.
    +2
  • King Umar
    0
    Thank you Manoj,i have tried your suggestions and it worked..many thanks :D
    0
  • 1 short reply
    • Manoj Bhoir
      +1
      Welcome. :)
      +1