T Hoecherl
asked on
Populate VB.net variables from SQL Select Query
I am calling this sql command from vb.net:
cmd.CommandText = "SELECT * FROM SNUGZ_EXT00101_SOP10200_2 WHERE PT_UD_KEY = '" & strKey & "'"
The sql query will return 1 row with several columns labeled PT_UD_1, PT_UD_2, etc.
I want to put the values in the columns into variables in my vb.net code. For example:
strImprint = PT_UD_1
strImprintColor = PT_UD_2
How do I code my vb.net to do this?
cmd.CommandText = "SELECT * FROM SNUGZ_EXT00101_SOP10200_2 WHERE PT_UD_KEY = '" & strKey & "'"
The sql query will return 1 row with several columns labeled PT_UD_1, PT_UD_2, etc.
I want to put the values in the columns into variables in my vb.net code. For example:
strImprint = PT_UD_1
strImprintColor = PT_UD_2
How do I code my vb.net to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Did the trick. Thanks.
ASKER
I only want to run the SQL query once. I don't want to run it each time for each of the 12 variables I need to populate.