index > .NET Framework Data Access and Storage > Null Value exception thrown, need to change default action

Null Value exception thrown, need to change default action

Migrating a legacy Access VB6 app to VS 2005 B2, the old app handles null's read from ADO recordsets in its own way.

The migrated code using a dataset is suffering from exceptions that the generated dataset code throws. I need to be able to reset the default action to either ignore or replace etc. This is an option for the field in the dataset (codegen etc).

However I would like to do it once for the entire dataset (30+ tables of 20 columns and n assorted queries etc). Doing this by hand for each field is a real pain.

Is there a way to change the default null handling option from throw exception to anything else, when initially generating the typed dataset.

Thanks


AndyP
AndyP

Hi AndyP,

When you design your typed dataset, you can specify the behavior for null values by modifing columns 'NullValue' property: Empty, Null and Throw exception (default).

You would open .XSD, in mode text, associated to your typed dataset and you replace all 'Throw exception' by 'Null'.

Good Coding!

Javier Luna
http://guydotnetxmlwebservices.blogspot.com/




Indigo: Ports, Messages, Channels and more...
Javier Luna
reply 2

You can use google to search for other answers

 

More Articles

• Read data from an Opened excel file with attribute= archive using...
• Output Parameters with Application Block's SqlHelper
• Visual Studio 2005
• alter the value of a table
• how to read only certain fields(columns) from a loaded dataset
• Generating sql query using C# code
• Changing the database asociated with a DataSet
• How to create a script for creation of users and roles in a DB?
• Geting Total Number of Rows in a Recordset
• Client to DLL that connects to a SQL Server database file
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• how to modify and upadate the data in da
• Connection problem to an Excel File with
• Selecting / Update records - Concurrancy
• Wish list for .NET 3.0 framework
• UniqueIdentifier as PK and TableAdapter
• Automatic Designer Replacement of 'local
• Importing An Excel Sheet In SQL SERVER 2
• Typed Dataset Question #2
• catcha sqlexception and column
• Excel Query: Can You Query Which Columns
• Enterprise Library for .NET Framework 2.
• got a form, got a database, the two don'
• Problem with SQL Server 2005 and IIS 6.0
• Connect to a Sybase Adaptive Server Anyw
• Table Adapter, set foreign key fields on

Hot Articles

• Transactionscope
• Returning controlled SQL data
• Informix Problem
• OCI-22053: overflow error caused when re
• Output File From DataSet.WriteXml() is M
• Number of Query values and destination f
• Read-only database problem after site in
• check user input data exist in database
• Copying tables from a dataset to a SQL T
• Store/retrieve Avi files to/from Sql Ser
• Regional Settings, depending of the form
• Web Form OleDbException (0x80004005): Di
• Microsoft.ApplicationBlocks.Data.SqlHelp
• Table Adapter, set foreign key fields on
• Build connection string like COM?

Recommend Articles

• Help with queries
• Transactionscope
• Update Statement - Syntax Problem
• Searching Database for results
• There is already an open DataReader asso
• how to open excel file (on server), writ
• Access problem - query returns some empt
• how to get a javascript value in c#
• how to use where clause in data adapter
• c#.net: Unable to update records with sq
• Data Insertion Updation Deletion in Mult
• OleDbCommandBuilder doesn't generate any
• Display autonumber
• XML scheme that causing crashing of the
• Add rows to DataTable