Timestamp Datatype issues

I

IntraRELY

I am having difficulties with a SQL 2000 TimeStamp column and my vb.net
application. I am getting various Cast errors. It isnt clear to me what
datatype to use when assigning the TimeStamp return value to a variable.

Here is my code when recieving the return value from a stored procedure. I
dont know what datatype I should use here. The stored procedure has an
timestamp OUPUT parameter. I have tried various methods, but this is what I
think it might look like, but isnt correct.

Dim globalTimeStampColumn As SqlBinary
globalTimeStampColumn =
CType(cmdTicketsUpdateRetrieve.Parameters("@timestampcolumn").Value,
SqlBinary)

TIA,

STeve
 
M

Miha Markic

Hi,

The value returned is array of 8 bytes.
Dim b() As Byte =
CTypecmdTicketsUpdateRetrieve.Parameters("@timestampcolumn").Value, Byte())
 
I

IntraRELY

On the SELECT stored procedure you suggestion works, but when I UPDATE I
recieve an error that the @timestampcolumn was not passed a parameter. The
commands are setup virtually the same, but one is an OUPUT (SELECT)
parameter and the other a INPUT (UPDATE). I am passing the variables
correctly?

Any ideas?

Steve
 
M

Miha Markic

IntraRELY said:
On the SELECT stored procedure you suggestion works, but when I UPDATE I
recieve an error that the @timestampcolumn was not passed a parameter. The
commands are setup virtually the same, but one is an OUPUT (SELECT)
parameter and the other a INPUT (UPDATE). I am passing the variables
correctly?

Hi Steve,

AFAIK timestamp column is readonly in Sql server - it won't let you insert a
value into.
The value itself is updated automatically each time you modify the row.
Other than that, you can easily pass a timestamp value to a stored procedure
by passing array of 8 bytes.
 
I

IntraRELY

I realize this. My stored procedure is simply using the passed timestamp
column in the WHERE clause. The UPDATE logic is taking the Primary Key and
the TimeStamp value, if there are no rows found, that means the TimeStamp
column has changed since the record was rendered in the browser. I will
re-examine my code, but once the global variable is declared, I simply pass
it to the update procedure...If you have any other ideas let me know.

Thanks for you help,

Steve Wofford
www.IntraRELY.com
 
M

Miha Markic

Hi Steve,

Did you try passing something like:

dim b() as byte = new byte[]{1, 2, 3, 4, 5,6, 7, 8}
param.Value = b

It works for me. How is your parameter defined?
 
I

IntraRELY

Thanks Miha,

I will try your suggestion, the stored proc is defined as timestamp.

Steve

Miha Markic said:
Hi Steve,

Did you try passing something like:

dim b() as byte = new byte[]{1, 2, 3, 4, 5,6, 7, 8}
param.Value = b

It works for me. How is your parameter defined?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

IntraRELY said:
I realize this. My stored procedure is simply using the passed timestamp
column in the WHERE clause. The UPDATE logic is taking the Primary Key and
the TimeStamp value, if there are no rows found, that means the TimeStamp
column has changed since the record was rendered in the browser. I will
re-examine my code, but once the global variable is declared, I simply pass
it to the update procedure...If you have any other ideas let me know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top