I'm using this code below to return some data from an access database using a query with a parameter passed to it:
Dim con As OleDbConnection = New OleDbConnection(GlobalVariables.connectionString)
Dim cmd As New OleDbCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Q_VIEW_SINGLE_TEST"
cmd.Parameters.Add("@TEST_ID", OleDbType.VarChar).Value = "17" ' Add Parameter
cmd.Connection = con
con.Open()
Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim ds As DataSet = New DataSet()
da.Fill(ds, "Table1")
dt = ds.Tables("Table1")
MsgBox(ds.Tables(0).Rows(0)(3))
It just keeps returning the old data however (so the data which was being returned when value was equal to 1:
cmd.Parameters.Add("@TEST_ID", OleDbType.VarChar).Value = "1"
What am I missing here?