We can't tell: we don't have any access to your data.
So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.
Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
But do yourself a favour or two:
1) Don't hardcode connection strings: that means you need to change it in a huge number of places when you release the software. Use a config file to store it. (How I do it is a little more complicated, but it saves time later:
Instance Storage - A Simple Way to Share Configuration Data among Applications[
^] - the code is in C#, but it's pretty obvious).
2) Don't pass unvalidated data to SQL: check your textbox content before assumign it contains valid numeric data! If you don't, SQL will throw an exception, and your app will crash. Use
Integer.TryParse[
^] to check and convert, then pass the integer value to SQL and complain to the user if it won't!