I'm really new and self taught so I don't know exactly how to ask questions here
That said I wrote this
Code:
Dim sqlConnections As New System.Data.SqlClient.SqlConnection(DataString)
Dim acmd As New System.Data.SqlClient.SqlCommand
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "SELECT TOP 1 ChangeLogID AS TheRow FROM ChangeLog ORDER BY ChangelogID DESC"
cmd.Connection = sqlConnections
sqlConnections.Open()
Dim TheRow = acmd("TheRow") 'this is the part that I don't know
acmd.ExecuteNonQuery()
sqlConnections.Close()
MsgBox("The magic number is " & TheRow)
and Dim TheRow = acmd("TheRow") doesn't work as I am sure it shouldn't since I am just relying on my old vbscript calls.
I'm strong in old ASP and VBS but I just started learing visual basic a couple of weeks ago and well its both awesome and horrible... but.....
How do I properly call the "TheRow" from the "As TheRow" in "cmd.CommandText = "SELECT TOP 1 ChangeLogID AS TheRow FROM ChangeLog ORDER BY ChangelogID DESC"" and set it to a variable?
The rest of the code works lol. I just can't set a needed variable from the data I am calling
please help