c# - Reading data returned from stored procedure -
I have a stored procedure that gives the table (or dataset or view or whatever), it's a < Code> Select ). I use the Entity Framework and I hope that it will make a unit and treat the stored procedure like a table. When I add Praty to unit schema, it is added, but no class has been generated (nothing appears in Schema or Intelligence).
I do not want to use this dataset solution which looks ugly and unaffected:
SQL Commands SQL Commands = New SQL Commands ("Spodojs Volksco"); SqlCommand.CommandType = CommandType.StoredProcedure; SqlCommand.Connection = New SqlConnection (Settings.Default.ConnectionStringTransit); SqlDataAdapter sa = New SqlDataAdapter (sqlCommand); Dataset dataset = new dataset (); Sa.fill (dataset); I've found a line that looks pretty clear:
var x = context.ExecuteStoreQuery & lt; T & gt; ("Sp_ProjetsVoxco"); But since the structure of the organization did not generate a class, I'm not sure what to do with T .
I think you have your own edmx file and now you have a The store is trying to add the process that you have already created in the database. 1 - You should add your store process by adding it like any other table using the database update model option, this EF knows about an SP (Because I already have my sp I'm showing the refresh tab, but you will see it in the Add tab of your SP if you have not added them yet)
Import the 2-function
4 - Click OK strong> and use the new method name p> Public IEnumerable & lt; mySPMethodCallName_Result & gt; ListAllServiceLogsFromSP (Decimal Customer ID) {var r = db.sp_ListServiceLogsByClientId Select SP (clientId); Return r; } Code> pre> div> html>
Comments
Post a Comment