11405.html
来自「VB技巧问答10000例 VB技巧问答10000例」· HTML 代码 · 共 26 行
HTML
26 行
<html>
<head>
<title>Problem using "timestamp" for concurrency control</title>
</head>
<body bgcolor="#FFFFFF" vlink="#808080">
<center>
<h1>Problem using "timestamp" for concurrency control</h1>
</center>
<hr size=7 width=75%>
<hr size=7 width=75%><p>
Posted by <a href="mailto:richard.pang@hongkong.com">Richard Pang</a> on March 27, 1999 at 00:18:55:<p>
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.<p>Here is my code:<br>Dim checktime <-?? I don't know what is the datatype<p>Private Sub Edit_click()<br>{data1.recordset.edit<br> checktime = data1.recordset("timestamp")<br>}<br>end sub<br> <br>Private Sub Save_click()<br>{If checktime = data1.recordset("timestamp")<br> 'To compare the up-to-date timestamp with the one previous retrieved<br> 'However, datatype mismatch. I don't know how to resolve<br> data1.recordset.update<br> msgbox "Successfully updated!"<br> Else<br> msgbox "Someone have changed your record during editing. Update abort.<br> end if<br>end sub<p>MS SQL Server table:<br>create table apart_pict(<br>id int IDENTITY (1,1) NOT NULL,<br>apart_id char(8) NULL,<br>timestamp NULL,<br>primary key(id))<p>Would anyone solve my problem? I can't retrieve data through dao and I can't do comparision.<p><br>Thank you for your help<br>Richard
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 11405-->
<!--top: 11413--><li><a href="11413.html">TimeStamp不是这样用</a> <b>cww</b> <i>11:25:34 3/27/99</i>
(<!--responses: 11413-->0)
<ul><!--insert: 11413-->
</ul><!--end: 11413-->
</ul><!--end: 11405-->
<br><hr size=7 width=75%><p>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?