Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005 C#
Hi,
 
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# asp.net
 
Thanks n regards,
 
protected void btnAllo_Click(object sender, EventArgs e)
    {
        string var_comp_no;
        string var_Tech_name;
        var_comp_no = ddlComplaint.SelectedValue;
        var_Tech_name=ddlAllow.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;
 
        try
        {
            con.Open();
 
            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);
 
        }
        finally
        {
            con.Close();
        }
    }
Posted 3-Jan-13 20:40pm
Edited 3-Jan-13 20:49pm
v2
Comments
aspnet_regiis -i at 4-Jan-13 1:44am
   
Error message is clear.. No need to tell you more
Sergey Alexandrovich Kryukov at 4-Jan-13 1:47am
   
How is this related to ASP.NET? Remove the tag "ASP.NET", add "ADO.NET".
—SA

1 solution

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

Solution 1

Check if the stored procedure Allocate_call exists on the database.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 190
1 PIEBALDconsult 150
2 BillWoodruff 148
3 DamithSL 140
4 Jochen Arndt 125
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2014
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