ASP.Net Error: Could not find stored procedure

Last Reply 7 months ago By dharmendr

Posted 7 months ago

my coding and sb code is correct but the error is occured..My error is ""Could not find stored procedure 'sp_zonal_insert'.""

        protected void Button1_Click(object sender, EventArgs e)
        {
            sqlCon.ConnectionString = objsqlHelpingClass.strSqlConnection;

            SqlCommand SqlCmd = new SqlCommand("sp_zonal_insert", sqlCon);
            SqlCmd.CommandType = CommandType.StoredProcedure;

            SqlCmd.Parameters.Add("@name", SqlDbType.VarChar).Value = txtname.Text;
            SqlCmd.Parameters.Add("@username", SqlDbType.VarChar).Value = txtusername.Text;
            SqlCmd.Parameters.Add("@password", SqlDbType.VarChar).Value = txtpassword.Text;
            SqlCmd.Parameters.Add("@gender", SqlDbType.VarChar).Value = ddlgender.Text;
            SqlCmd.Parameters.Add("@phoneno", SqlDbType.VarChar).Value = txtphoneno.Text;
            SqlCmd.Parameters.Add("@experience", SqlDbType.VarChar).Value = ddlexperience.Text;
            SqlCmd.Parameters.Add("@qualification", SqlDbType.VarChar).Value = ddlqualification.Text;
            SqlCmd.Parameters.Add("@certificate", SqlDbType.VarChar).Value = cbcertificate.Text;
            SqlCmd.Parameters.Add("@category", SqlDbType.VarChar).Value = ddlcategory.Text;
            SqlCmd.Parameters.Add("@gmail", SqlDbType.VarChar).Value = txtgmail.Text;
            SqlCmd.Parameters.Add("@type", SqlDbType.Int).Value = 1;

            sqlCon.Open();
            int intRowAffected = SqlCmd.ExecuteNonQuery();
            sqlCon.Close();
            if (intRowAffected > 0)
            {
                lblWarning.Text = "New User Added Successfully";
            }
        }

 

CREATE proc [dbo].[sp_zonal_insert]    
 @id int,
 @name varchar(max),
 @username varchar(max),
 @phoneno varchar(max),
 @category varchar(max),
 @password varchar(max),
 @gender varchar(max),
 @gmail varchar(max),
 @qualification varchar(max),
 @certificate varchar(max),
 @experience varchar(max)
 ,@type int
as    
begin    
if @type=1    
begin  
insert into zonal(name,username,phoneno,Category,password,gender,gmail,qualification,certificate,experience)
values (@name,@category,@password,@gender,@gmail,@username,@certificate,@qualification,@experience,@phoneno)
 end    

please check my code and clear my mistake.

This question does not have replies that have been liked.