# TimeStamp不是这样用

Posted by cww on March 27, 1999 at 11:25:34:

In Reply to: Problem using "timestamp" for concurrency control posted by Richard Pang on March 27, 1999 at 00:18:55:

: I link Visual Basic 5 with MS SQL Server 6.5. My problem is that I cannot retrieve and store "timestamp" field from table in MS SQL Server. My purpose is to store value of timestamp when editing and to compare the current and stored values so that I know whether this recordset is updated by other people or not during my editing.

1.TimeStamp在vb可能没有哪个资料型态与之对应，除了
Variant 或Byte()，它是8个Byte的资料
2.就算真的用以下的方式可做
checktime = data1.recordset("timestamp")
.
.
If checktime = data1.recordset("timestamp")
那这条件句也一定会相同，因为资料您早就抓到Client端了，
除非Rehresh资料，要不然二者一定相同
所以，应是去Update它，而后再看看Update有没有产
生冲突，若有再来重新Update一次。
TimeStamp是Sql Server内部查询资料有没有被更新
过的判断依据，不是我们程式设计者能去控制的

: 'To compare the up-to-date timestamp with the one previous retrieved
: 'However, datatype mismatch. I don't know how to resolve
: data1.recordset.update
: msgbox "Successfully updated!"
: Else
: msgbox "Someone have changed your record during editing. Update abort.
: end if
: end sub

: MS SQL Server table:
: create table apart_pict(
: id int IDENTITY (1,1) NOT NULL,
: apart_id char(8) NULL,
: timestamp NULL,
: primary key(id))

: Would anyone solve my problem? I can't retrieve data through dao and I can't do comparision.

:
: Thank you for your help
: Richard

Follow Ups: