Hi.
I m having trouble with a small method I wrote. Would be nice f someone can help me.

this is my method:-

public IQueryable getCustomerOrderList(DateTime dt)
    {
        var customerList = from p in dc.CustomerOrders
                           where p.OrderDate == dt && p.OrderStatus == true
                           select new {p.aspnet_Membership.aspnet_User.UserName,p.OrderNo,p.OrderDate,p.Note,p.DeliveryStatus,p.DeliveryTime };
        return customerList;
    }

And this is the error i am having:-

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Recommended Answers

All 2 Replies

Can you post the code that is calling that particular function? My hunch is that your datetime argument is invalid.

Can you post the code that is calling that particular function? My hunch is that your datetime argument is invalid.

Actually I am passing the parameter from the Object Data Source's selecting event and trying to bind the result in a grid.

This is from where I am passing the parameter:-

protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
    {

        e.InputParameters["dt"] = DateTime.Now;
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.