well i don't know if 2008 is different from 2010..
but that code works on 2010,i think that could work also on 2008..
try it...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Objects;
using System.Data.SqlClient;
using System.Data.EntityClient;
public static DataTable ExecuteStoredProcedure(ObjectContext db, string storedProcedureName, List<SqlParameter> parameters)
{
var connectionString = ((EntityConnection)db.Connection).StoreConnection.ConnectionString;
using (var data = new DataTable())
{
using (var conn = new SqlConnection(connectionString))
{
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = storedProcedureName;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddRange(parameters.ToArray());
using (var adapter = new SqlDataAdapter(cmd))
{
adapter.Fill(data);
}
}
}
return data;
}
}
i remember that i created a View with the same schema that i excepected from the stored
and i imported it as entity in the model.
so the "entity" has the same imprint as the view