Click here to Skip to main content
15,881,709 members

Could not find stored procedure error

Member 9579525 asked:

Open original thread
SQL
//Stored procedure
ALTER PROCEDURE dbo.HDR_PROFILE_proc(@first_name varchar(15), @middle_name varchar(15), @last_name varchar(15),
@address varchar(150), @Mob_No varchar(15),@birthdate datetime , @gender bit, @email_id varchar(50), @user_id varchar(15), @password varchar(15), @confirm_pass varchar(15), @country varchar(15), @city varchar(15)  )
	
AS
insert into DSProfile.HDR_PROFILE(first_name , middle_name ,last_name ,address , contact_number ,birth_date , gender, email_id, user_name , password , confirm_password ,country , city )values(@first_name , @middle_name , @last_name ,
@address , @Mob_No ,@birthdate  , @gender , @email_id ,  @user_id, @password , @confirm_pass , @country , @city   )
RETURN

C#
//code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    SqlConnection con;
   
     
    protected void Page_Load(object sender, EventArgs e)
    {
        con = Connectivity.GetConnection();
        txt_userid.Enabled = false;
        txt_first_name.Focus();
       
    }

    protected void txtsubmit_Click(object sender, EventArgs e)
    {
        SqlCommand cmd = new SqlCommand("[dbo].[HDR_PROFILE_proc]", con);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        //cmd.CommandText = "HDR_PROFILE_proc";
        
        cmd.Parameters.AddWithValue("@first_name", txt_first_name.Text);
        cmd.Parameters.AddWithValue("@middle_name", txt_middle_name.Text);
        cmd.Parameters.AddWithValue("@last_name", txt_last_name.Text);
        cmd.Parameters.AddWithValue("@address", txt_address.Text);
        cmd.Parameters.AddWithValue("@Mob_No", txt_mob_no.Text);
        cmd.Parameters.AddWithValue("@birthdate", Convert.ToString(txt_birthdate.Text));
        cmd.Parameters.AddWithValue("@gender", Rdo_gender.SelectedIndex);

        cmd.Parameters.AddWithValue("@email_id", txt_email.Text);

        if (Rdobtn_userid.Checked == true)
        {
            cmd.Parameters.AddWithValue("@user_name", txt_userid.Text);
            //cmd.Parameters.AddWithValue("@Login_with_email",'0');
        }
        //else
        //{ 
           // cmd.Parameters.AddWithValue("@Login_with_email",'1')
        //}
        
        cmd.Parameters.AddWithValue("@password", txt_pass.Text);
        cmd.Parameters.AddWithValue("@confirm_pass", txt_confirm_pass.Text);
        cmd.Parameters.AddWithValue("@country", txt_country.Text);
        cmd.Parameters.AddWithValue("@city", txt_city.Text);

        DataSet ds = new DataSet();
        da.Fill(ds); //exception ocuured here
        cmd.ExecuteNonQuery();
        con.Close();
    }   
}
Tags: ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900