I am new to Entity Framework, I am trying to bind the gridview with the stored procedure I write as follows
var ietsParameter = new SqlParameter("@ID", 1000);
grdStoreProc.DataSource = entities.ExecuteStoreCommand("selectData2 @ID", ietsParameter);
grdStoreProc.DataBind();
But I am getting an exception
Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
Can someone tell me any alternative way to achieve this?
ExecuteStoreCommandis used to execute a command to the database with anintreturn type that tells how much rows were affected.You should use
ExecuteStoreQueryinstead.Check this link from samples