ASP操作sqlserver数据库,执行没有报错,但是数据没有变化,跪问!!!!!在线等
用asp操作数据库,执行后,没有报错,但是数据库中的数据没有变化。
我用了两种操作方式,都不行
sqlserver表结构:
CREATE TABLE [dbo].[walk_in_id] (
[attend_id] [nchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[status] [nchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[reg_type] [nchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL )
ASP中的操作代码
第一种方式:
strQtemp1 = "update walk_in_id set status= 'Y ' where attend_id= ' " & Trim(strAttendID) & " ' "
g_SQLConn.execute strQtemp1
第二种方式:
Set cmdCID = Server.CreateObject( "ADODB.Command ")
cmdCID.CommandText = "spi_NewAtt "
cmdCID.CommandType = adCmdStoredProc
cmdCID.ActiveConnection = g_SQLConn
cmdCID.Parameters.Append cmdCID.CreateParameter ( "@Firstname ", adVarWChar, adParamInput, 100, Trim(strFirstName))
cmdCID.Parameters.Append cmdCID.CreateParameter ( "@Lastname ", adVarWChar, adParamInput, 100, Trim(strLastName))
cmdCID.Parameters.Append cmdCID.CreateParameter ( "@Company ", adVarWChar, adParamInput, 100, Trim(strOrganization))
cmdCID.Parameters.Append cmdCID.CreateParameter ( "@AttID ", adVarWChar, adParamInput, 20, Trim(strAttendID))
cmdCID.Execute()
Set cmdCID = Nothing
存储过程的内容如下:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N '[dbo].[spi_NewAtt] ') and OBJECTPROPERTY(id, N 'IsProcedure ') = 1)
drop procedure [dbo].[spi_NewAtt]
GO
CREATE PROCEDURE dbo.spi_NewAtt
@FirstName NVARCHAR(100),
@LastName NVARCHAR(100),
@Company NVARCHAR(100),
@AttID NVARCHAR(10)
AS
update walk_in_id set status = 'Y ' where attend_id = @AttID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
多谢各位大虾!!!!!!什么问题呢????
------解决方案--------------------直接在查询分析器中写:
select ... from ... where attend_id = 某个值.
看是否有这条记录.
然后再写:
update walk_in_id set status = 'Y ' where attend_id = 某个值
看是否改写.
------解决方案--------------------路过,帮你顶!