每次我运行我的更新函数时,我都会生成一个过程或函数有太多参数指定错误,我想我已经看这个太久了,因为我找不到根本原因。任何指导将不胜感激。
我的 VB.NET 代码如下:
Public Function UpdateGenInfo_E1_01_02(ByVal pstrCon As String, _
ByVal appNo As String, _
ByVal revNo As String, _
ByVal prName As String, _
ByVal prAddr As String, _
ByVal prAddr2 As String, _
ByVal prCity As String, _
ByVal prState As String, _
ByVal prZip As String) As Integer
Try
'Create parameter
Dim lsqlParams(8) As SqlParameter
'fill parameter
lsqlParams(0) = New SqlParameter("@AppNo", appNo)
lsqlParams(1) = New SqlParameter("@RevNo", revNo)
lsqlParams(2) = New SqlParameter("@PrName", prName)
lsqlParams(3) = New SqlParameter("@PrAddr", prAddr)
lsqlParams(4) = New SqlParameter("@PrAddr2", prAddr)
lsqlParams(5) = New SqlParameter("@PrCity", prCity)
lsqlParams(6) = New SqlParameter("@PrState", prState)
lsqlParams(7) = New SqlParameter("@PrZip", prZip)
'Return dataset
Return SqlHelper.ExecuteNonQuery(pstrCon, CommandType.StoredProcedure, "up_UpdateGenInfo_E1_01_02", lsqlParams)
Catch ex As Exception
'Throw error
Throw ex
End Try
End Function
我的存储过程如下:
USE [EpUpdates]
GO
/****** Object: StoredProcedure [dbo].[up_UpdateGenInfo_E1_01_02] Script Date: 04/26/2013 12:00:24 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[up_UpdateGenInfo_E1_01_02]
(
@AppNo varchar(10),
@RevNo varchar(4),
@PrName varchar(10),
@PrAddr varchar(50),
@PrAddr2 varchar(50),
@PrCity varchar(30),
@PrState varchar(2),
@PrZip varchar(10)
)
AS
UPDATE EpUpdates.dbo.GenInfo_E1_01_02
SET PrName=@PrName,
PrAddr=@PrAddr,
PrAddr2= @PrAddr2,
PrCity=@PrCity,
PrState=@PrState,
PrZip=@PrZip
WHERE (AppNo = @AppNo)
AND (RevNo = @RevNo)