The data reader returned by the store data provider does not have enough columns
- by molgan
Hello
I get the following error when I try to execute a stored procedure:
"The data reader returned by the store data provider does not have enough columns"
When I in the sql-manager execute it like this:
DECLARE @return_value int,
@EndDate datetime
EXEC @return_value = [dbo].[GetSomeDate]
@SomeID = 91,
@EndDate = @EndDate OUTPUT
SELECT @EndDate as N'@EndDate'
SELECT 'Return Value' = @return_value
GO
It returns the value properly.... @SomeDate = '2010-03-24 09:00'
And in my app I have:
if (_entities.Connection.State == System.Data.ConnectionState.Closed)
_entities.Connection.Open();
using (EntityCommand c = new EntityCommand("MyAppEntities.GetSomeDate", (EntityConnection)this._entities.Connection))
{
c.CommandType = System.Data.CommandType.StoredProcedure;
EntityParameter paramSomeID = new EntityParameter("SomeID", System.Data.DbType.Int32);
paramSomeID.Direction = System.Data.ParameterDirection.Input;
paramSomeID.Value = someID;
c.Parameters.Add(paramSomeID);
EntityParameter paramSomeDate = new EntityParameter("SomeDate", System.Data.DbType.DateTime);
SomeDate.Direction = System.Data.ParameterDirection.Output;
c.Parameters.Add(paramSomeDate);
int retval = c.ExecuteNonQuery();
return (DateTime?)c.Parameters["SomeDate"].Value;
Why does it complain about columns? I googled on error and someone said something about removing RETURN in sp, but I dont have any RETURN there.
last like is like SELECT @SomeDate = D.SomeDate FROM ....
/M