How to update the data using stored procedures code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bommanaboyina
    New Member
    • Mar 2011
    • 2

    How to update the data using stored procedures code?

    iam using textbox1,textbo x2,textbox3 for Empid,Ename,Esa lary and iam upadting the data using update button for that im using stored procedure for updating ename esalary and the problem is some times i dont want to update the Ename but i wrote the stored procedure for updating both ename and esalary as well....when iam leaving the textbox2 as empty iam getting the errors so how can i modify my stored procedure with if statement for accepting the previous values also if i laeve textbox as empty
  • Antony Nadan
    New Member
    • Mar 2011
    • 5

    #2
    If you have empid as the primary key and if you are updating based on the empid ,, u should not get any sort of error, even if you leave the textbox2 or textbox3 empty.......

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Build a dynamic SQL string in the stored procedure using the ifs and then execute that. Make sure you sanitize the inputs first.

      Comment

      • bommanaboyina
        New Member
        • Mar 2011
        • 2

        #4
        Hai Rabb, can u plz provide me the solution i.e, procedure with if's for my problem........ .........

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Sorry, we don't provide full solutions here. We can help you get there but we won't do it all for you.

          Comment

          Working...