Get data in oledb command
hello guys im having a problem how to compare the result of the query..
for example i have a command "Select RemainTime from time where username = username"
how do i get the result of the query and compare it to a string
this is what i do..
vb.net Code:
dim remain as string
'and then the command
using reader as oledb.oledbdatareader = command.executereader()
remain = reader.getvalue(0)
if remain = textbox1.text
'statements
else
'statements
end if
end using
is this correct..?
Re: Get data in oledb command
If you want to execute a query to get a single value then call ExecuteScalar rather than ExecuteReader. It will return the actual value, rather than a DataReader. For an example, follow the CodeBank link in my signature and check out my thread on Retrieving & Saving Data.