473,769 Members | 7,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Null int/float columns with TableAdapters

Hi,

I have a database table which has some "float" columns which allow
nulls. I have created a TableAdapter to view this table.

If I open the TableAdapter and there are null values for some of the
float columns then an exception is thrown:

Line 2136: try {
Line 2137: return
((double)(this[this.tableProdu cts.MaxPressure BarColumn]));
Line 2138: }
Line 2139: catch (System.Invalid CastException e) {

[StrongTypingExc eption: The value for column 'MaxPressureBar ' in table
'Products' is DBNull.]

With string values, you can change the NullValue property to "null" in
the xsd file and all is well - however it won't let you do this for
anything other than strings even though .NET 2 supports null values for
ints floats and decimals etc...

Is there any way I can make this work? Or some kind of workaround I can use?

The only thing I can think to do is prevent the float columns from being
null and use 0 instead. But for some of the columns, zero is a valid
value and I need to be able to distinguish between 0 and null in the code.

Help!

Nick...
Aug 25 '06 #1
1 2067
Hi Nick,

This is a known issue of typed DataSet in .NET 2.0. The generated code
snippet is actually from the typed DataSet (for example:
DataSet1.Table3 Row) rather than the TableAdapter. As the TableAdapter's
documentation (http://msdn2.microsoft.com/en-us/library/bz9tthwx.aspx)
claimed: The TableAdapters support nullable types Nullable(Of T) and T?.
You should see the Insert or Update method of your TableAdapter does use
"System.Nullabl e<double>" as parameter data type.

We looked really closely at extending typed DataSet to support Nullable
types. However, Nullable types were added a bit late in the cycle and we
just didn't have the time to work out all the plumbing issues up and down
the stack. Because typed DataSet serializes into untyped DataSets, and due
to the way DataBinding works with Views, adding Nullable types in the
strongly typed DataSet was problematic. Another issue is related to
compatibility with .NET 1.x.

There's already a related feedbak on this issue:

http://connect.microsoft.com/VisualS...k.aspx?Feedbac
kID=121229

As the product team responded, it will be considered for a future
enhancement. Thank you for your feedback!

Hope this helps. Please feel free to post here if anything is unclear.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 28 '06 #2

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

Similar topics

2
4319
by: Penguinny | last post by:
Dear all, I am trying to make a relatively simple layout with two adjustment columns filled with short news pieces, but there's a catch. I cannot control the html for these news bits, so I am left with CSS only for positioning etc. My problem is the following. The most natural way to do what I want is to use "float: left" (or "float: right") for my news bits and see them all filling the space. However, there's the catch: if the news...
3
7093
by: Robb Gilmore | last post by:
Hello, We have a C#.NET app which is calling a Java webservice. We use the wsdl file exportted from the java webservice to create our web-reference in Visual Studio. We are able to create the parameter classes and call the webservice just fine. Our problem is, within our .Net app, we have some value objects ( like floats, for instance ) which are meant to be null. Since there is no null float, we use float.minvalue to indicate a...
3
4267
by: Christopher Kimbell | last post by:
I have a class library that contains a number of TableAdapters and I'm using this from a web application. Is there a way of getting the TableAdapters to use the connectionstrings defined in web.config. From the MSDN documentation it seems like it's possible to override settings with values in a config file for winform applications. Is the same possible for web applications. I have tried to add a connectionstring (under the...
7
1390
by: CMM | last post by:
Unless someone has come up with a way, I still don't understand how you can use TableAdapters in a true n-tier infrastructure.... where the DataAccessLayer is in one Dll and *only* the Datasets themselves can be shared across layers. I find it inconceivable that this suggestion http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=d2907b53-885b-4d24-bc9c-1a04d76036e4 (that's not me who suggested it) has been marked...
3
2067
by: Ganesh Palaniappan | last post by:
We're getting following exception for the below piece of code. We're wondering how it is possible since we're having a null check for objGraphics and strokePen... Exception: System.NullReferenceException: Object reference not set to an instance of an object
6
3664
by: Jeff Kish | last post by:
Greetings. I need to convert some columns of type numeric(12, 0) to hold floating point information scale and precision I can't determine in advance (customer data can vary wildly) so I wanted to use the datatype that offers the maximum scale and precision.. I'm targeting sql server 2005 systems (not 2000). It seems my choices are real and float, and the docs seem to indicate that
7
2494
by: =?Utf-8?B?R3JlZw==?= | last post by:
When using the VS Wizards to create a DataSet I select tables. Then, I use the TableAdapter Configuration Wizard to modify the underlying queries that retreive the data. What I'm wonder is, does this TableAdapter work in the same manner as a SQL Server Stored Procedure or View? Or, does it work like MS Access where it pulls all the data over and then filters it? Or, should I be making my data sources for the TableAdapters stored...
1
1785
by: Mark Baldwin | last post by:
Steven Thanks for your reply, however the typed datasets are defined in the web service and there seems to way to open the partial class code window - double clicking on the design surface does nothing. I can do this in the client for a client specific dataset, but not in the web service. -- Best regards Mark Baldwin
4
5439
by: kaka123 | last post by:
hey, im doing this program and im reading the information from a file, i cant figure out how to get the print out right. Ive looked at all my for loops and i thought the error would be in the "substrings" that im doing..mabye the errror is in lines 25-39? this might be alost cause cause you cant run this file without the data file, but the scores and averages work, but the the peoples names dont print out right it says Null Null M 58 68 73...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.