更新包含timestamp列的SQL2005表 [英] Updating SQL2005 table containing timestamp column

查看:54
本文介绍了更新包含timestamp列的SQL2005表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我有这个问题的正确论坛。我有一个现有的Windows

应用程序,它使用SQL Server数据库和存储过程。我现在开发一个Web应用程序来使用相同的数据库。


原始的更新和删除SP'都使用时间戳来获得concurreny

检查。


我试图从我的sqlDataSource使用相同的更新SP,但我保持

收到以下错误:


操作数类型冲突:sql_variant与时间戳不兼容


有人可以帮忙吗?


-

Mal Ball

I hope I have the right forum for this question. I have an existing Windows
application which uses a SQL Server database and stored procedures. I am now
developing a web application to use the same database.

The original Update and Delete SP''s all use a timestamp for concurreny
checking.

I am trying to use the same Update SP from my sqlDataSource but I keep
getting the following error:

Operand type clash: sql_variant is incompatible with timestamp

Can anyone help please?

--
Mal Ball

推荐答案

嗨Mal,


你的意思是当您使用相同的SP在

sqlDataSource中进行更新时,是否生成了操作数类型冲突错误?如果是的话,你可以告诉我SP。如果SP有参数,你能告诉我

参数是如何通过的吗?


Kevin Yu

==== ===

此帖子已提供原样没有保证,并且不授予

权利。

Hi Mal,

Do you mean that when you use the same SP to do the update in
sqlDataSource, the Operand type clash error was generated? If yes, could
you show me the SP. If the SP has paramters, can you show me how the
parameters were passed?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


SP如下:

CREATE PROCEDURE [dbo]。[updatecustomer]

@customerid int,

@customername char(40),

@ address1 char(30 ),

@ address2 char(30),

@town char(30),

@county int,

@postcode char(10),

@country int,

@phone char(20),

@fax char(20) ,

@web char(40),

@assignedto int,

@details文本,

@lastupdated datetime,

@updateby char(30),

@timestamp timestamp

as

update customer set customername = @customername,address1 =

@ address1,address2 = @ address2,town = @town,

county = @county,postcode = @ postcode,country = @country,phone =

@phone,

fax = @fax,web = @web,assignedto = @assignedto,details = @details,

updateby = @updateby,lastupdat ed = @lastupdated

其中customerid = @customerid

和timestamp = @timestamp


使用sqlDataSource传递参数更新程序为

更新方法


参数绑定在FormView控件的文本框中作为Bind(timestamp)

-

Mal Ball

" Kevin Yu [MSFT]"写道:
SP is as follows:
CREATE PROCEDURE [dbo].[updatecustomer]
@customerid int,
@customername char(40),
@address1 char(30),
@address2 char(30),
@town char(30),
@county int,
@postcode char(10),
@country int,
@phone char(20),
@fax char(20),
@web char(40),
@assignedto int,
@details text,
@lastupdated datetime,
@updateby char(30),
@timestamp timestamp
as
update customer set customername = @customername, address1 =
@address1,address2 = @address2, town = @town,
county = @county, postcode = @postcode,country = @country, phone =
@phone,
fax = @fax, web = @web, assignedto = @assignedto, details = @details,
updateby = @updateby, lastupdated = @lastupdated
where customerid = @customerid
and timestamp = @timestamp

Parameters are passed using a sqlDataSource using this update procedure as
the update method

Parameters are bound in a textbox on a FormView control as Bind("timestamp")
--
Mal Ball
"Kevin Yu [MSFT]" wrote:
嗨Mal,

你的意思是当你使用相同的SP在sqlDataSource中进行更新时,操作数类型冲突生成错误?如果是,可以告诉我SP。如果SP有参数,你能告诉我
参数是如何通过的吗?

Kevin Yu
=======
这个帖子是提供按原样没有保证,也没有授予
权利。
Hi Mal,

Do you mean that when you use the same SP to do the update in
sqlDataSource, the Operand type clash error was generated? If yes, could
you show me the SP. If the SP has paramters, can you show me how the
parameters were passed?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."



嗨Mal,


我在我的机器上测试它,时间戳字段检查并发性,并且

它工作正常。如果你重新创建sqlDataSource,这仍然会发生吗?

Kevin Yu

=======

" This发布是按原样提供的。没有保证,也没有赋予

权利。

Hi Mal,

I tested it on my machine with a timestamp field checking concurrency, and
it works fine. Does this still occurs if you recreate the sqlDataSource?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


这篇关于更新包含timestamp列的SQL2005表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆