473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ObjectDataSource - Select - Nullable parameter

Hello,

Have an objectdatasource with a method much like this:

public SomeDataSet.MyDataTable getMyDataTable(int? pkID)
{
if (pkID == null)
return adapater.GetMyTable("ALL")
else
return adapter.GetMyTable("SING")
}

When I configure the objectdatasource I tell it to call this method
for the select. In the define parameters if I give it a value of 1, or
2, or some other integer works fine. If I tell it to use null as the
default value, at run time I get an error "Input string was not in
correct format". Any ideas anyone?

Thanks

Ray
Jun 27 '08 #1
2 2642
On May 7, 6:16*pm, rbrowning1958 <RBrowning1...@gmail.comwrote:
Hello,

Have an objectdatasource with a method much like this:

public SomeDataSet.MyDataTable getMyDataTable(int? pkID)
{
* if (pkID == null)
* * *return adapater.GetMyTable("ALL")
* else
* * *return adapter.GetMyTable("SING")

}

When I configure the objectdatasource I tell it to call this method
for the select. In the define parameters if I give it a value of 1, or
2, or some other integer works fine. If I tell it to use null as the
default value, at run time I get an error "Input string was not in
correct format". Any ideas anyone?

Thanks

Ray
For anyone interested I solved this. You just leave the parameter
empty - don't try typing in null doh!

Ray
Jun 27 '08 #2

"rbrowning1958" <RB***********@gmail.comwrote in message
news:6b**********************************@b64g2000 hsa.googlegroups.com...
Hello,

Have an objectdatasource with a method much like this:

public SomeDataSet.MyDataTable getMyDataTable(int? pkID)
{
if (pkID == null)
return adapater.GetMyTable("ALL")
else
return adapter.GetMyTable("SING")
}

When I configure the objectdatasource I tell it to call this method
for the select. In the define parameters if I give it a value of 1, or
2, or some other integer works fine. If I tell it to use null as the
default value, at run time I get an error "Input string was not in
correct format". Any ideas anyone?

Thanks

Ray
If I may make a suggestion. Create an enum with each value for GetMyTable
and then use a switch statement to do the correct GetMyTable. In case you
have to get another table this would be much more flexable and
understandable later.

LS

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dotnet Gruven | last post by:
I've posted this in the adonet group, however it was suggested I might have better luck here.... ============================================================= I'm trying to use a typed dataset and...
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
1
by: Scott F K Hooper | last post by:
My ASP.NET 2.0 project has a GridView that I want to be able to edit and update records with. The GridView has been bound to an ObjectDataSource control that has the following Update method...
2
by: planetthoughtful | last post by:
Hi All, I have an ASP.NET page that displays a GridView control based on an ObjectDataSource control. I'm wondering if it's possible to base the ObjectDataSource in question on a parameter...
0
by: Angel | last post by:
I created a Dataset Type on one project which generates a DLL. I have a web project . I created a webpage with a gridview. I attached an ObjectDatasource to the Dataset type from my other project....
0
by: Steve B. | last post by:
Hi, On a page, I've a dropdownlist box that is bound to an object datasource (which is a proxy to a web service). I also have a gridview that is bound to another object datasource (a ws too)....
0
by: Bryce Fischer | last post by:
I've got a simple (I think) asp.net application. I've created a DataSet in App_Code/ItemDataSet.xsd. Tested connection, seemed to work fine. In my ASPX file, I first dropped an...
0
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to...
3
by: btreddy | last post by:
Hii all, I've a problem regarding passing select parameters to objectdatasource from code behind. i would like to pass the select parameters to a objectdatasource ..not in the selecting or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.