title: Execute a stored procedure using VB.NET
body: <p>This is my procedure</p>
  
  <pre><code>ALTER PROCEDURE sp_addUser
       @UserName nvarchar(50),    
       @Prenom nvarchar(50),  
       @Nom nvarchar(50), 
       @Mail nvarchar(50),    
       @Password char(8), 
       @Addresse nvarchar(100),   
       @Ville nvarchar(50),   
       @Province nvarchar(50),    
       @PostalCode char(6),
       @Pays nvarchar(50),    
       @AnimalGenre nvarchar(50), 
       @NomAnimal nvarchar(50),   
       @Race nvarchar(50) 
  AS
  BEGIN
     INSERT INTO Client
     VALUES (@UserName,@Prenom,@Nom,@Mail,@Password,@Addresse,@Ville,@Province,@PostalCode,@Pays,@AnimalGenre,@NomAnimal,@Race);
  END 
  </code></pre>
  
  <p>I think this ok for the stored Procedure</p>
  
  <p>Now the code to add value in Data Base</p>
  
  <pre><code>Sub sp_addUser()
  
      Dim intRowsAff As Integer
  
      lblErrMsg.Text = ""
      lblRecsAff.Text = ""
  
      Dim connectionString As String = WebConfigurationManager.ConnectionStrings("BecsEtMuseauxSQL").ConnectionString
      Dim con As SqlConnection = New SqlConnection(connectionString)
  
      Dim cmd As New SqlCommand("sp_addUser", con)
  
      cmd.CommandType = CommandType.StoredProcedure
      cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 50).Value = txtUserName.Text
      cmd.Parameters.Add("@Prenom", SqlDbType.VarChar, 50).Value = txtPrenom.Text
      cmd.Parameters.Add("@Nom", SqlDbType.NVarChar, 50).Value = txtNom.Text
      cmd.Parameters.Add("@Mail", SqlDbType.NVarChar, 50).Value = txtMail.Text
      cmd.Parameters.Add("@Password", SqlDbType.Char, 8).Value = txtPass.Text
      cmd.Parameters.Add("@Addresse", SqlDbType.NVarChar, 100).Value = txtAdresse.Text
      cmd.Parameters.Add("@Ville", SqlDbType.NVarChar, 50).Value = txtVille.Text
      cmd.Parameters.Add("@Province", SqlDbType.NVarChar, 50).Value = txtProvince.Text
      cmd.Parameters.Add("@PostalCode", SqlDbType.Char, 6).Value = txtPostal.Text
      cmd.Parameters.Add("@Pays", SqlDbType.NVarChar, 50).Value = txtPays.Text
      cmd.Parameters.Add("@AnimalGenre", SqlDbType.NVarChar, 50).Value = rblAnimal.Text
      cmd.Parameters.Add("@NomAnimal", SqlDbType.NVarChar, 50).Value = txtAnimal.Text
      cmd.Parameters.Add("@Race", SqlDbType.NVarChar, 50).Value = txtRace.Text
  
      Try
          cmd.Connection.Open()
          intRowsAff = cmd.ExecuteNonQuery()
      Catch ex As Exception
          lblErrMsg.Text = ex.Message &amp; ex.Source
      End Try
      lblRecsAff.Text = intRowsAff &amp; " record(s) inserted"
      cmd.Connection.Close()
  End Sub
  </code></pre>
  
  <p>After I execute the method VS said that I have to much specified arguments for the  procedure sp_addUser</p>
  
  <p>I don't understand why this generate error!</p>