I have created a stored procedure and when I implement in coding but got an error....
I wrote a code
SqlConnection conn;
SqlCommand comm;
string connectionString = ConfigurationManager.ConnectionStrings["Dorknozzle"].ConnectionString;
conn = new SqlConnection(connectionString);
comm = new SqlCommand("InsertHelpDesk2", conn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("@EmployeeID", System.Data.SqlDbType.Int,50);
comm.Parameters["@EmployeeID"].Value = 5;
comm.Parameters.Add("@StationNumber", System.Data.SqlDbType.Int);
comm.Parameters["@StationNumber"].Value = stationTextBox.Text;
comm.Parameters.Add("@CategoryID", System.Data.SqlDbType.Int);
comm.Parameters["@CategoryID"].Value = categorylist.SelectedItem.Value;
comm.Parameters.Add("@SubjectID", System.Data.SqlDbType.Int);
comm.Parameters["@SubjectID"].Value = subjectlist.SelectedItem.Value;
comm.Parameters.Add("@Description", System.Data.SqlDbType.NVarChar, 50);
comm.Parameters["@Description"].Value = descriptionTextBox.Text;
comm.Parameters.Add("@StatusID", System.Data.SqlDbType.Int);
comm.Parameters["@StatusID"].Value = 1;
conn.Open();
comm.ExecuteNonQuery();
Response.Redirect("HelpDesk.aspx");
conn.Close();
and in MS-SQL 2008 i wrote
CREATE PROCEDURE InsertHelpDesk2
(
@EmployeeID int,
@StationNumber int,
@CategoryID int,
@SubjectID int,
@Description nvarchar(50),
@StatusID int
)
AS
INSERT INTO Dorknozzle1.dbo.HelpDesk1 (EmployeeID, StationNumber, CategoryID,
SubjectID, Description, StatusID)
VALUES (@EmployeeID, @StationNumber, @CategoryID, @SubjectID,
@Description, @StatusID)
error i got is
I am getting error on
comm.ExecuteNonQuery();
Could not find stored procedure 'InsertHelpDesk2'
please tell me where i am wrong