Hi all
here's a small piece of code:
Sub DisplayAsset (aid)
Dim sql As String, sqlret As String
sql = "SELECT ID, AssetID, Type FROM assets WHERE AssetID ='" & aid & "'"
Command.CommandText = sql
'Initiate Data Reader
Datareader.New1
Datareader.Value = Command.ExecuteReader
sqlret = Datareader.GetValue(2)
Datareader.Close
End Sub
The first time this code runs it returns one record containing the asset or item we're looking for (and we can see this in the sqlret variable). If I then execute the same code again, either using the same asset id or another one, it returns nothing!
If I run the code with a simple SELECT * query it returns all records correctly no matter how many times we run it.
What is going on? It's driving me and a colleague nuts here.
Thanks!
here's a small piece of code:
Sub DisplayAsset (aid)
Dim sql As String, sqlret As String
sql = "SELECT ID, AssetID, Type FROM assets WHERE AssetID ='" & aid & "'"
Command.CommandText = sql
'Initiate Data Reader
Datareader.New1
Datareader.Value = Command.ExecuteReader
sqlret = Datareader.GetValue(2)
Datareader.Close
End Sub
The first time this code runs it returns one record containing the asset or item we're looking for (and we can see this in the sqlret variable). If I then execute the same code again, either using the same asset id or another one, it returns nothing!
If I run the code with a simple SELECT * query it returns all records correctly no matter how many times we run it.
What is going on? It's driving me and a colleague nuts here.
Thanks!