views:

678

answers:

3

RequestDate != @RequestDate = null

Gives me an ERROR: The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.

A: 

For configuring your Where expression, you should add to the WhereParameters collection like so:

                    <asp:LinqDataSource ID="LinqDataSourceDivisionMemberships" runat="server" 
                        ContextTypeName="NYDERHE.NYDERHEDataClassesDataContext" EnableDelete="True" 
                        EnableInsert="True" TableName="DivisionMemberships" 
                        Where="FacultyMemberID == @FacultyMemberID">
                        <WhereParameters>
                            <asp:ControlParameter ControlID="hdnFacultyMemberID" Name="FacultyMemberID" 
                                PropertyName="Value" Type="Int32" DefaultValue="0" />
                        </WhereParameters>
                    </asp:LinqDataSource>

In addition to ControlParameters, there are QueryStringParameters, just plain Parameters (which you often set in the code-behind or leave as their default value), and more.

JoshJordan
A: 

In reponse to:

I am trying to load data that RequestDate has null value and I am using C#

Why not use

Where = "RequestDate == null"
JoshJordan
A: 

If you are trying to select records where RequestDate is null then what about

 from r in table where ! r.RequestDate.HasValue select r
sgmoore