Click here to Skip to main content
13,046,773 members (40,873 online)
Rate this:
Please Sign up or sign in to vote.

I m a trying below code to insert data in database.. but there is error "Stored could not find stored procedure 'Allocate_call'".

Where to define stored procedure in c#

Thanks n regards,

protected void btnAllo_Click(object sender, EventArgs e)
        string var_comp_no;
        string var_Tech_name;
        var_comp_no = ddlComplaint.SelectedValue;
        SqlCommand cmd_insert = new SqlCommand();
        SqlConnection con = new SqlConnection("SERVER=KSHITIJA-PC; Initial Catalog=CRM;Integrated Security=True");
        cmd_insert.Connection = con;
        cmd_insert.CommandType = CommandType.StoredProcedure;
        cmd_insert.CommandText = "Allocate_Call";
        cmd_insert.Parameters.Add(new SqlParameter("@comp_no", SqlDbType.Int));
        cmd_insert.Parameters["@comp_no"].Value = var_comp_no; ;
        cmd_insert.Parameters.Add(new SqlParameter("@Tech_name", SqlDbType.VarChar, 50));
        cmd_insert.Parameters["@Tech_name"].Value = var_Tech_name;
            int i = cmd_insert.ExecuteNonQuery(); ;
            //int a = cmd1.ExecuteNonQuery();
            if (i == 1)
                ddlComplaint.SelectedItem.Text = "";
                EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
                MsgBox1.Show("Message: ", "Call Assigned to Technician", null, mb);
        catch (Exception ex)
            EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
            MsgBox1.Show("Error: ", ex.Message, null, mb);
Posted 3-Jan-13 19:40pm
Updated 3-Jan-13 19:49pm
aspnet_regiis -i 4-Jan-13 1:44am
Error message is clear.. No need to tell you more
How is this related to ASP.NET? Remove the tag "ASP.NET", add "ADO.NET".

1 solution

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

Solution 1

Check if the stored procedure Allocate_call exists on the database.

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 | Mobile
Web02 | 2.8.170713.1 | Last Updated 4 Jan 2013
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