Click here to Skip to main content
13,287,856 members (53,879 online)
Rate this:
Please Sign up or sign in to vote.
See more:
//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)  )
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   )

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;
    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",'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
Posted 7-Nov-12 1:34am
faisal23 7-Nov-12 6:36am
check connection string, database name, stored procedure name
Member 9579525 7-Nov-12 6:50am
Thank u...
Member 9579525 8-Nov-12 0:14am
will it give error if i wont write schema name before procedure name? and in insert query?
create procedure [schema name].[procedure name]
insert into [schema name][table name] values()
Marcus Kramer 8-Nov-12 9:10am
If no schema is given, then dbo is by default checked.
Tadit Dash 7-Nov-12 6:38am
Please ask question in a correct way.

From the error, anyone can say that there is no stored procedure in the database, which you are trying to execute.

Member 9579525 7-Nov-12 6:53am
Thank u...but I am asking question means there should be stored procedure..
Tadit Dash 7-Nov-12 6:56am
So, give us some more information.
Where did u encounter this issue, I mean where in the code you found this exception ?
Post some codes.

Member 9579525 7-Nov-12 6:58am exception on line "da.Fill(ds)" after submiting form...
Tadit Dash 7-Nov-12 7:04am
Can you post the entire codes on that page ? It will be easier to find the issue.
jim lahey 7-Nov-12 7:16am
Don't post your questions here, click on "Improve Question" and put your amendments there or they will get overlooked.
Tadit Dash 7-Nov-12 7:41am
Have you opened the connection ?
I can't find any codes for that...
Tadit Dash 7-Nov-12 8:12am
Now I have to try your code and come back to you.
Thanks again for all the information.
I will come back after I try it out.
faisal23 8-Nov-12 1:07am
bro you take birthdate in datetime in datetime fromat and you passing parameter in string may this is error.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I think you don't need to specify [dbo]. when you are calling stored procedure of DBO schema.
you can use either
SqlCommand cmd = new SqlCommand("dbo.HDR_PROFILE_proc", con);

SqlCommand cmd = new SqlCommand("HDR_PROFILE_proc", con);

Hope that helps
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You have done this
DataSet ds = new DataSet();
Try this (Without inserting data what you are trying to fill in dataset)
DataSet ds = new DataSet();
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

SqlCommand cmd = new SqlCommand("[dbo].[HDR_PROFILE_proc]", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText="ur stored procedure name"; //add this
SqlDataAdapter da = new SqlDataAdapter(cmd);
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

If you have same issue,
Could not find stored procedure error

Please check the "ConnectionString". Which u provided in Web.config.

Check the ConnectionString name, Database name, Server name.

Thanks & Regards
Ganesh Pate
Richard Deeming 16-Aug-16 9:08am
Your answer duplicates the very first comment posted to the question - nearly FOUR YEARS AGO!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 16 Aug 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100