Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / November 2005



Tip: Looking for answers? Try searching our database.

Optimistic Concurrency and TimeStamp

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott H. - 21 Oct 2005 16:16 GMT
Hi,
I would like to implement optimistic concurrency where I retrieve the
timestamp of a record in a table with a stored procedure and save the
timestamp value into a vb.net variable. This represents the original
timestamp for the record. When a user updates the record, I would like to
pass the original timestamp to a stored procedure that performs the update to
ensure the record has not been changed by another user. The problem is, how
do I store the original timestamp value from SQL Server 2000 in vb.net? I
have tried:

Dim OrigTstamp() as Byte

I can assign an incoming timestamp to a byte array but I'm not certain if
anything is there. I then have great difficulty passing the OrigTstamp() to
the update stored procedure.
Signature

Thanks,
Scott H.

Tom Moreau - 22 Oct 2005 13:09 GMT
Treat it the same as a SQL binary(8).

Signature

  Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON   Canada
www.pinpub.com
.

Hi,
I would like to implement optimistic concurrency where I retrieve the
timestamp of a record in a table with a stored procedure and save the
timestamp value into a vb.net variable. This represents the original
timestamp for the record. When a user updates the record, I would like to
pass the original timestamp to a stored procedure that performs the update
to
ensure the record has not been changed by another user. The problem is, how
do I store the original timestamp value from SQL Server 2000 in vb.net? I
have tried:

Dim OrigTstamp() as Byte

I can assign an incoming timestamp to a byte array but I'm not certain if
anything is there. I then have great difficulty passing the OrigTstamp() to
the update stored procedure.
Signature

Thanks,
Scott H.

Scott H. - 22 Oct 2005 13:24 GMT
I was able to take the TimeStamp value in as a byte array and send it out to
the stored procedure as an SqlDbType.Timestamp.
Signature

Scott H.

> Treat it the same as a SQL binary(8).
>
[quoted text clipped - 14 lines]
> anything is there. I then have great difficulty passing the OrigTstamp() to
> the update stored procedure.
JoshP - 29 Nov 2005 05:09 GMT
Hi, I am using C# and I want to read a timestamp value in to my asp.net
application.  I have loaded the value into a dataset object and would like to
assign the timestamp value to a local variable:

ex.
timestamp = oDataSet.Tables[0].Rows[0]["RecordCheck"];

After I have stored the timestamp, I want to be able to compare it to the
timestamp of the row just before I update the row:

ex.
using WHERE RecordCheck = timestamp

any help would be greatly appreciated.

> I was able to take the TimeStamp value in as a byte array and send it out to
> the stored procedure as an SqlDbType.Timestamp.
[quoted text clipped - 17 lines]
> > anything is there. I then have great difficulty passing the OrigTstamp() to
> > the update stored procedure.
Tom Moreau - 29 Nov 2005 12:06 GMT
You can use a stored proc or parameterized query and then feed it the
timestamp as a parameter.

Signature

  Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON   Canada
www.pinpub.com
.

Hi, I am using C# and I want to read a timestamp value in to my asp.net
application.  I have loaded the value into a dataset object and would like
to
assign the timestamp value to a local variable:

ex.
timestamp = oDataSet.Tables[0].Rows[0]["RecordCheck"];

After I have stored the timestamp, I want to be able to compare it to the
timestamp of the row just before I update the row:

ex.
using WHERE RecordCheck = timestamp

any help would be greatly appreciated.

"Scott H." wrote:

> I was able to take the TimeStamp value in as a byte array and send it out
> to
[quoted text clipped - 23 lines]
> > to
> > the update stored procedure.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.