Note that there are some explanatory texts on larger screens.

plurals
  1. POProcedure or function deleteprofile has too many arguments specified
    primarykey
    data
    text
    <p>I'm working on a web application using asp.net on my gridview im using a command field edit button that calls a stored procedure for updating the data but while updating</p> <p>I'm getting the following error:</p> <blockquote> <p>Procedure or function updateprofile has too many arguments specified.</p> <p>Description:<br> An unhandled exception occurred during the execution of the current web request.<br> Please review the stack trace for more information about the error and where it<br> originated in the code.</p> <p>Exception Details:<br> System.Data.SqlClient.SqlException: Procedure or function updateprofile has too many<br> arguments specified.</p> </blockquote> <p>This is my stored procedure:</p> <pre><code>ALTER procedure [dbo].[updateprofile] @pid int, @pfirstname varchar(50), @plastname varchar(50), @padress varchar(50), @pemail varchar(50), @ptelephone varchar(50), @pbirthday date as begin update profile set firstname = @pfirstname, @plastname = lastname, @padress = adress, @pemail = email, @ptelephone = telephone, birthday = @pbirthday where id = @pid end </code></pre> <p>And this is my asp code:</p> <pre><code>SelectCommand="selectAllProfile" SelectCommandType="StoredProcedure" UpdateCommand="updateprofile" UpdateCommandType="StoredProcedure" DeleteCommand="deleteprofile" DeleteCommandType="StoredProcedure" &lt;UpdateParameters&gt; &lt;asp:Parameter Name="pid" Type="Int32" /&gt; &lt;asp:Parameter Name="pfirstname" Type="String" /&gt; &lt;asp:Parameter Name="plastname" Type="String" /&gt; &lt;asp:Parameter Name="padress" Type="String" /&gt; &lt;asp:Parameter Name="pemail" Type="String" /&gt; &lt;asp:Parameter Name="ptelephone" Type="String" /&gt; &lt;asp:Parameter DbType="Date" Name="pbirthday" /&gt; &lt;/UpdateParameters&gt; </code></pre> <p>btw im facing the same error for the delete command</p> <p>this is my vb code:</p> <pre><code>Imports System.Data.SqlClient Imports System.Data Imports Class1e Public Class Profile_test Inherits System.Web.UI.Page Dim rc As Integer Dim inc As Integer Dim dt As New DataTable Dim x As New Class1e Protected Sub Btn_save_Click(sender As Object, e As System.EventArgs) Handles Btn_save.Click If id_txt.Text.Length = 0 Then x.insertProfile(fname_txt.Text, lname_txt.Text, adresss_txt.Text, email_txt.Text, birthday_txt.Text, phone_txt.Text) id_txt.Text = "0" Else x.updateProfile(id_txt.Text, fname_txt.Text, lname_txt.Text, adresss_txt.Text, email_txt.Text, birthday_txt.Text, phone_txt.Text) End If GridView1.DataBind() End Sub Protected Sub GridView1_Load(sender As Object, e As System.EventArgs) Handles GridView1.Load GridView1.Columns(1).Visible = False End Sub Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles GridView1.SelectedIndexChanged Dim row As GridViewRow = GridView1.SelectedRow id_txt.Text = row.Cells(1).Text fname_txt.Text = row.Cells(2).Text lname_txt.Text = row.Cells(3).Text adresss_txt.Text = row.Cells(4).Text email_txt.Text = row.Cells(5).Text phone_txt.Text = row.Cells(6).Text birthday_txt.Text = row.Cells(7).Text End Sub Protected Sub btn_new_Click(sender As Object, e As System.EventArgs) Handles btn_new.Click fname_txt.Text = "" lname_txt.Text = "" adresss_txt.Text = "" email_txt.Text = "" phone_txt.Text = "" birthday_txt.Text = "" id_txt.Text = "" End Sub </code></pre> <p>This is my vb class code:</p> <pre><code>Public Class Class1e Dim x As String Public Sub New() End Sub Public connectionString As String = ConfigurationManager.ConnectionStrings("TestConnectionString").ConnectionString Public cn As SqlConnection = New SqlConnection(connectionString) Public Sub updateProfile(ByVal id As Integer, ByVal fname As String, ByVal lname As String, ByVal adress As String, ByVal email As String, ByVal birthday As String, ByVal phone As String) Try Dim command As SqlCommand = New SqlCommand("updateprofile", cn) command.CommandType = CommandType.StoredProcedure command.Parameters.AddWithValue("@pid", id) If fname.Length = 0 Then MsgBox("First name is a required file") Else command.Parameters.AddWithValue("@pfirstname", fname) End If If lname.Length = 0 Then MsgBox("Last Name is a required file") Else command.Parameters.AddWithValue("@plastname", lname) End If command.Parameters.AddWithValue("@padress", adress) If email.IndexOf(".") = -1 Or email.IndexOf("@") = -1 Then MsgBox("The email format should be name@domain.com") Else command.Parameters.AddWithValue("@pemail", email) End If If phone.Length = 0 Then MsgBox("Tel is a required file") Else If phone.Length &lt;&gt; 8 Then MsgBox("The tel should be 8 digits") Else command.Parameters.AddWithValue("@ptelephone", phone) End If End If command.Parameters.AddWithValue("@pbirthday", birthday) If cn.State = ConnectionState.Closed Then cn.Open() End If command.ExecuteNonQuery() MsgBox("1 Record updated ") Catch ex As Exception MsgBox(ex.Message) Finally If cn.State = ConnectionState.Open Then cn.Close() End If End Try End Sub Public Sub deleteProfile(ByVal id As Integer) Try Dim command As SqlCommand = New SqlCommand("deleteprofile", cn) command.CommandType = CommandType.StoredProcedure command.Parameters.AddWithValue("@pid", id) If cn.State = ConnectionState.Closed Then cn.Open() End If command.ExecuteNonQuery() MsgBox("1 Record deleted ") Catch ex As Exception MsgBox(ex.Message) Finally If cn.State = ConnectionState.Open Then cn.Close() End If End Try End Sub Public Sub insertProfile(ByVal fname As String, ByVal lname As String, ByVal adress As String, ByVal email As String, ByVal birthday As String, ByVal phone As String) Try Dim command As SqlCommand = New SqlCommand("insertprofile", cn) command.CommandType = CommandType.StoredProcedure If fname.Length = 0 Then MsgBox("First name is a required file") Else command.Parameters.AddWithValue("@pfirstname", fname) End If If lname.Length = 0 Then MsgBox("Last Name is a required file") Else command.Parameters.AddWithValue("@plastname", lname) End If command.Parameters.AddWithValue("@padress", adress) If email.IndexOf(".") = -1 Or email.IndexOf("@") = -1 Then MsgBox("The email format should be name@domain.com") Else command.Parameters.AddWithValue("@pemail", email) End If If phone.Length = 0 Then MsgBox("Tel is a required file") Else If phone.Length &lt;&gt; 8 Then MsgBox("The tel should be 8 digits") Else command.Parameters.AddWithValue("@ptelephone", phone) End If End If command.Parameters.AddWithValue("@pbirthday", birthday) command.Parameters.AddWithValue("@pprocessed", 0) If cn.State = ConnectionState.Closed Then cn.Open() End If command.ExecuteNonQuery() MsgBox("1 Record inserted ") Catch ex As Exception MsgBox(ex.Message) Finally If cn.State = ConnectionState.Open Then cn.Close() End If End Try End Sub End Class </code></pre> <p>Awaiting your reply</p> <p>Your help is much appreciated :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload