You need to cast the returned object from executeScalar. Use the toString() method and it should work OK.
hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 167
No, cast the executeScalar command as it returns an object which you then try to jam in to Tuition. tuition is of type int right? Casting Tuition after it has incorrectly stored the executeScalar won't fix the issue.
hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 167
Sorry, I meant Tuition is of type string in my post above, not int obviously.
hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 167
I agree with GeekByChoice in both that waqasaslammeo's answer is rubish and that you need to run your SQL query against db and verify that it's working as expected before troubleshooting anything else.
May I suggest the Debug.Print (SQL) instead of msgbox? I find it very usefull to get the contents of queries in the immediate pane instead of a messagebox as I can copy and paste in the db or wherever needed.
adam_k
Practically a Posting Shark
803 posts since Jun 2011
Reputation Points: 256
Solved Threads: 149