Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Could not find stored procedure
Message
From
12/02/2021 10:26:50
 
 
To
All
General information
Forum:
C#
Category:
Databases
Title:
Could not find stored procedure
Miscellaneous
Thread ID:
01678182
Message ID:
01678182
Views:
40
Hi,
I have created a stored procedure in my database on SQL Server.
I am trying to call this from some C# code and getting the error: System.Data.SqlClient.SqlException (0x80131904): Could not find stored procedure 'EXEC dbo.TatilUpdateEmployee'

I have triple and quadruple checked my spelling of the stored procedure name. Here is the code:
            using (SqlCommand cmdUpdateEmployee = new SqlCommand("EXEC dbo.TatilUpdateEmployee", dbConnection))
            {
                cmdUpdateEmployee.CommandType = CommandType.StoredProcedure;
                cmdUpdateEmployee.Parameters.AddWithValue("@emp_firstname", tatilEmployeesRow["name_first"]);
                    cmdUpdateEmployee.Parameters.AddWithValue("@emp_middlename", (string)tatilEmployeesRow["name_middle"] != "NULL" ? (string)tatilEmployeesRow["name_middle"] : null);
                 cmdUpdateEmployee.Parameters.AddWithValue("@emp_lastname", tatilEmployeesRow["name_last"]);
                cmdUpdateEmployee.Parameters.AddWithValue("@emp_sexfk", tatilEmployeesRow["gender"]);
                cmdUpdateEmployee.Parameters.AddWithValue("@emp_dob", tatilEmployeesRow["birth_date"]);
                cmdUpdateEmployee.Parameters.AddWithValue("@emp_number", tatilEmployeesRow["family_eligibility_ud"]);

                cmdUpdateEmployee.ExecuteNonQuery();
}
the dbConnection is definitely connecting to the correct database because it is successfully getting data updated by other parts of the code which use the same dbConnection.

What am I missing?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Next
Reply
Map
View

Click here to load this message in the networking platform