Is it possible to capture the value returned from executing a SQL statement executed through the Code Behind window?
I have a script that works fine, and the VB in the code behind window also works fine. However, I want to expand the VB script if possible, so that I can execute the following algorithm:
Open connection to database
Execute SQL statement to check if value exists in a database table
If the value exists then
Close connection to database
What I need to understand is how to get a result back from an execution statement such as:
thisCommand.CommandText = "SELECT myValue FROM DatabaseTable"
Is this possible? Is there a better way? If so, what do I need to do to make it happen?
When I run the following code, the value returned to my variable aResult is always -1, regardless of whether the search succeeds or not: