ASP.Net Error: Could not find stored procedure

Last Reply one year ago By dharmendr

Posted one year 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;

            int intRowAffected = SqlCmd.ExecuteNonQuery();
            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
if @type=1    
insert into zonal(name,username,phoneno,Category,password,gender,gmail,qualification,certificate,experience)
values (@name,@category,@password,@gender,@gmail,@username,@certificate,@qualification,@experience,@phoneno)

please check my code and clear my mistake.

You are viewing reply posted by: dharmendr one year ago.
Posted one year ago

Hi ArunaAbi,

The error suggested that the stored procedure sp_zonal_insert you are trying to access is not present in the Database you are connected. So make sure that the stored procedure is present in the Database if not present execute the stored procedure.

If it is present check your stored procedure schema. It might be other than dbo.

Please check the database if it contains the stored procedure

sp_helptext [sp_zonal_insert]

If it returns defination that means it is in database.