Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

entity framework call stored procedure with parameters

  using (var entities = new YourEntities())
                {
                    SqlParameter[] parameters =
                      {
                          new SqlParameter{
                                SqlDbType = SqlDbType.NVarChar,
                                Size = -1,
                                Direction = ParameterDirection.Input,
                                ParameterName = "InCompanyCode",
                                Value = SD.Company
                            },
                            new SqlParameter{
                                SqlDbType = SqlDbType.NVarChar,
                                Size = -1,
                                Direction = ParameterDirection.Input,
                                ParameterName = "InDebugModeOn",
                                Value = "0"
                            }
                        };

                   return entities.Database.SqlQuery<Your_Model>
                        (@"EXECUTE YourSP @InCompanyCode,@InBranchCode", parameters).ToList();                }
 
PREVIOUS NEXT
Tagged: #entity #framework #call #stored #procedure #parameters
ADD COMMENT
Topic
Name
1+6 =