Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Could not find stored procedure
Message
De
12/02/2021 10:26:50
 
 
À
Tous
Information générale
Forum:
C#
Catégorie:
Bases de données
Titre:
Could not find stored procedure
Divers
Thread ID:
01678182
Message ID:
01678182
Vues:
38
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform