How do I get the value from Sql command
Posted on 2008-10-21
I have the following code Sub on an Visual Studio 2008 project.
How do I assigned the result value of the SQL Query to a variable
I'm new into to datasets so I'm trying to understand them a little
I think I need to create a dataset and fill it with the resulst of the query and search trhough there.
I was just wondering if there is a straight way of doing this without creating a data set
sample code expected!!
Private Sub CHECKMAXID()
Dim cmd As OleDb.OleDbCommand
sSql = ""
sSql = "SELECT MAX(ID) FROM MASTER"
If Con.State = ConnectionState.Closed Then Con.Open()
cmd = New OleDb.OleDbCommand(sSql, Con)