Reputation: 19
With Visual Basic in Visual Studio I am trying to select a row of type rowversion from a SQL Server database.
'version' is a column of type rowversion
SELECT [Version] FROM Employees WHERE Employee_id = 1
Then in VB - To get value from version column
Dim myBuffer As Byte()
Dim reader As SqlDataReader
numRead = reader.GetBytes(0, 0, myBuffer, 0, 16)
I know there is data in mybuffer from this:
For i = 0 To myBuffer.Length - 1
MsgBox(myBuffer(i).ToString())
Next
Also myBuffer.Length = 9
But when I want to query my database with myBuffer...
cmd.Parameters.AddWithValue("version", myBuffer)
I get the error:
Procedure or function 'updatePerson' expects parameter '@version', which was not supplied.
As if myBuffer in NULL.
Does anybody know to get the rowversion out of a database and then use it in a query?
Upvotes: 1
Views: 443