提前感谢您的帮助。非常感谢。
经过两个长时间的搜索Stack Overflow和其他Google搜索结果,因为我得到的“程序或函数指定了太多参数”,我找不到有用的帮助。原因是无处不在,我读到我可能要么指定了太多参数,我的参数名称不正确,或者类型不正确。这些都不适合我的情况。这是我的代码:
USE [BANK_DB]
GO
/****** Object: StoredProcedure [dbo].[P_INSERT_T_INFORAMTION_SETING] Script Date: 03/08/2017 03:15:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[P_INSERT_T_INFORAMTION_SETING]
@CLIENT_CODECHECK INT ,
@ID_INFO int OUTPUT
,@BANK_NAME nvarchar(max)
,@BANK_ADDRESS nvarchar(max)
,@MONEY_TYPE nvarchar(max)
,@LINCES_ID nvarchar(MAX)
,@TAX_ACCOUNTANT nvarchar(MAX)
,@EMPLOEE_NAME nvarchar(max)
,@BOSS_NAME nvarchar(max)
,@FLAG_RECOGNIZE int
,@START_TICKT_DATE date
,@END_TIKET_DATE date
,@SUBMIT_FLAG INT OUTPUT
,@BANK_NAME_EN nvarchar(max)
,@FOREMAN_EMPLOYEE nvarchar(max)
,@ASSOCIATE_Director nvarchar(max)
AS
DECLARE
@C_MAX AS INT,
@ACC_MAX AS INT ,
@C_COUNT INT
BEGIN
SET @SUBMIT_FLAG=0
SET @C_COUNT=(SELECT COUNT(ID_INFO) FROM T_INFORMATION_SETTING WHERE ID_INFO=@CLIENT_CODECHECK)
IF @C_COUNT>0
BEGIN
SET @SUBMIT_FLAG=0
RETURN
END
set @ACC_MAX=(SELECT ISNULL(MAX(ID_INFO), 0) FROM T_INFORMATION_SETTING) +1
INSERT INTO [dbo].[T_INFORMATION_SETTING]
([ID_INFO]
,[BANK_NAME]
,[BANK_ADDRESS]
,[MONEY_TYPE]
,[LINCES_ID]
,[TAX_ACCOUNTANT]
,[EMPLOEE_NAME]
,[BOSS_NAME]
,[FLAG_RECOGNIZE]
,[START_TICKT_DATE]
,[END_TIKET_DATE]
,[BANK_NAME_EN]
,[FOREMAN_EMPLOYEE]
,[ASSOCIATE_Director] )
VALUES
(@ACC_MAX
,@BANK_NAME
,@BANK_ADDRESS
,@MONEY_TYPE
,@LINCES_ID
,@TAX_ACCOUNTANT
,@EMPLOEE_NAME
,@BOSS_NAME
,@FLAG_RECOGNIZE
,@START_TICKT_DATE
,@END_TIKET_DATE
,@BANK_NAME_EN
,@FOREMAN_EMPLOYEE
,@ASSOCIATE_Director
)
set @ID_INFO=@ACC_MAX
IF @@ERROR <>0
BEGIN
ROLLBACK
RETURN
END
SET @SUBMIT_FLAG=1
END
这是C#方面的事情:
Private Sub BTN_SAVE_Click(sender As Object, e As EventArgs) Handles BTN_SAVE.Click
'Try
If FROM_DATE.Text = TO_DATE.Text Then
MessageBox.Show("ttt")
Return
End If
If DataGridView1.Rows.Count - 1 < 0 Then
MessageBox.Show("pleasr")
Return
Exit Sub
End If
If MsgBox("You sure to save", MsgBoxStyle.YesNo + MsgBoxStyle.Question, MSG_APP) = MsgBoxResult.No Then Exit Sub
' new_date.Value =
' DATE_SALE.Value.AddDays(Convert.ToInt32(My.Settings.DATE_END))
Dim INSER_ED = New BANK_ACCOUNT.BANK_DBDataSetTableAdapters.QueriesTableAdapter
INSER_ED.P_INSERT_T_INFORAMTION_SETING(-1, ID_INFO, My.Settings.BANK_NAME, My.Settings.ADDRESS, My.Settings.MONEY_TYPE, My.Settings.LINCES_ID, My.Settings.TAX_ACCOUNTANT, My.Settings.EMPLOEE_NAME, My.Settings.BOSS_NAME, 1, DATE_TIKCIT.Value, Convert.ToDateTime(DATE_TIKCIT.Value.AddDays(Convert.ToInt32(My.Settings.DATE_END))), 1, My.Settings.BANK_NAME_EN, My.Settings.FOREMAN_EMPLOYEE, My.Settings.ASSOCIATE_Director, FROM_DATE.Value, TO_DATE.Value)
NUMBER_ACTION = ID_INFO
Dim I As Integer
For I = 0 To DataGridView1.Rows.Count - 1
Dim INSERTED = New BANK_ACCOUNT.BANK_DBDataSetTableAdapters.QueriesTableAdapter
INSERTED.P_INSERT_T_CLIENTS(0, ID_CUSTOMER, DataGridView1.Rows(I).Cells(3).Value.ToString, DataGridView1.Rows(I).Cells(4).Value.ToString, Convert.ToInt32(DataGridView1.Rows(I).Cells(5).Value), DataGridView1.Rows(I).Cells(7).Value.ToString, DataGridView1.Rows(I).Cells(8).Value.ToString, Convert.ToDateTime(DataGridView1.Rows(I).Cells(9).Value), Convert.ToDateTime(DataGridView1.Rows(I).Cells(10).Value), DataGridView1.Rows(I).Cells(12).Value.ToString, 1, Convert.ToDecimal(DataGridView1.Rows(I).Cells(11).Value), Convert.ToDateTime(DataGridView1.Rows(I).Cells(6).Value), Convert.ToInt32(Val(My.Settings.START_NUM)), True, SUBMET_FLAG)
Dim INS_DET = New BANK_ACCOUNT.BANK_DBDataSetTableAdapters.QueriesTableAdapter
INS_DET.P_INSERT_T_DETAILS(ID_INFO, ID_CUSTOMER, SUBMIT_FLAG)
Next
If SUBMIT_FLAG = 1 Then
MSG_SAVE()
My.Settings.SAVE_FALGE = 0
My.Settings.Save()
DIFF_SAVE = 0
Me.GET_MX_NUMBERTableAdapter.Fill(Me.BANK_DBDataSet.GET_MX_NUMBER)
LBL_NUM.Text = Me.BANK_DBDataSet.GET_MX_NUMBER.Rows(0)(0)
Button1_Click_1(Nothing, Nothing)
Else
MSG_ERROR()
End If
' BTN_SAVE.Enabled = False
' Catch ex As Exception
'MsgBox(ex.Message)
'End Try
End Sub
Private Sub BTN_SAVE_Click(sender As Object, e As EventArgs) Handles BTN_SAVE.Click
'Try
If FROM_DATE.Text = TO_DATE.Text Then
MessageBox.Show("")
Return
End If
If DataGridView1.Rows.Count - 1 < 0 Then
MessageBox.Show("test")
Return
Exit Sub
End If
If MsgBox("you sure to save?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, MSG_APP) = MsgBoxResult.No Then Exit Sub
' new_date.Value =
' DATE_SALE.Value.AddDays(Convert.ToInt32(My.Settings.DATE_END))
Dim INSER_ED = New BANK_ACCOUNT.BANK_DBDataSetTableAdapters.QueriesTableAdapter
INSER_ED.P_INSERT_T_INFORAMTION_SETING(-1, ID_INFO, My.Settings.BANK_NAME, My.Settings.ADDRESS, My.Settings.MONEY_TYPE, My.Settings.LINCES_ID, My.Settings.TAX_ACCOUNTANT, My.Settings.EMPLOEE_NAME, My.Settings.BOSS_NAME, 1, DATE_TIKCIT.Value, Convert.ToDateTime(DATE_TIKCIT.Value.AddDays(Convert.ToInt32(My.Settings.DATE_END))), 1, My.Settings.BANK_NAME_EN, My.Settings.FOREMAN_EMPLOYEE, My.Settings.ASSOCIATE_Director, FROM_DATE.Value, TO_DATE.Value)
NUMBER_ACTION = ID_INFO
Dim I As Integer
For I = 0 To DataGridView1.Rows.Count - 1
Dim INSERTED = New BANK_ACCOUNT.BANK_DBDataSetTableAdapters.QueriesTableAdapter
INSERTED.P_INSERT_T_CLIENTS(0, ID_CUSTOMER, DataGridView1.Rows(I).Cells(3).Value.ToString, DataGridView1.Rows(I).Cells(4).Value.ToString, Convert.ToInt32(DataGridView1.Rows(I).Cells(5).Value), DataGridView1.Rows(I).Cells(7).Value.ToString, DataGridView1.Rows(I).Cells(8).Value.ToString, Convert.ToDateTime(DataGridView1.Rows(I).Cells(9).Value), Convert.ToDateTime(DataGridView1.Rows(I).Cells(10).Value), DataGridView1.Rows(I).Cells(12).Value.ToString, 1, Convert.ToDecimal(DataGridView1.Rows(I).Cells(11).Value), Convert.ToDateTime(DataGridView1.Rows(I).Cells(6).Value), Convert.ToInt32(Val(My.Settings.START_NUM)), True, SUBMET_FLAG)
Dim INS_DET = New BANK_ACCOUNT.BANK_DBDataSetTableAdapters.QueriesTableAdapter
INS_DET.P_INSERT_T_DETAILS(ID_INFO, ID_CUSTOMER, SUBMIT_FLAG)
Next
If SUBMIT_FLAG = 1 Then
MSG_SAVE()
My.Settings.SAVE_FALGE = 0
My.Settings.Save()
DIFF_SAVE = 0
Me.GET_MX_NUMBERTableAdapter.Fill(Me.BANK_DBDataSet.GET_MX_NUMBER)
LBL_NUM.Text = Me.BANK_DBDataSet.GET_MX_NUMBER.Rows(0)(0)
Button1_Click_1(Nothing, Nothing)
Else
MSG_ERROR()
End If
' BTN_SAVE.Enabled = False
' Catch ex As Exception
'MsgBox(ex.Message)
'End Try
End Sub
答案 0 :(得分:1)
错误&#34;过程或函数指定的参数太多&#34;应该足够清楚 - proc有16个参数,但你的调用有18个。尝试从调用中删除最后2个(FROM_DATE.Value,TO_DATE.Value)。