Passing null parameter to objectdatasource

G

Guest

I have an objectdatasource on a dataset.
From a webform (textbox) I want to pass a parameter to this dataset which
can be null. If so I want all the rows of that dataset to be retrieved in a
grid.
(WHERE (MEMBER_ID = ISNULL(@MEMBER_ID, MEMBER_ID)))

This clause seems to work fine in preview of the dataset.
In the parameter definition screen of my objectdatasource I set
ConvertEmptyStringtonull to true and I don't specify a default value.
When I try to view the page in the browser I get the following error:

Value cannot be null.
Parameter name: MEMBER_ID
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: MEMBER_ID
Source Error:

Line 2506: Me.Adapter.SelectCommand = Me.CommandCollection(0)
Line 2507: If (MEMBER_ID Is Nothing) Then
Line 2508: Throw New
System.ArgumentNullException("MEMBER_ID")
Line 2509: Else
Line 2510: Me.Adapter.SelectCommand.Parameters(0).Value =
CType(MEMBER_ID,String)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top