为什么这会返回 null?
//seedDate is set to DateTime.Now; con is initialized and open. Not a problem with that
using (SqlCommand command = new SqlCommand("fn_last_business_date", con))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@seed_date", seedDate);//@seed_date is the param name
object res = command.ExecuteScalar(); //res is always null
}
但是当我直接在数据库中调用它时,如下所示:
select dbo.fn_last_business_date('8/3/2011 3:01:21 PM')
returns '2011-08-03 15:01:21.000'
这是我从代码中调用它时希望看到的结果
为什么,为什么,为什么?