Version 1.1 of my post (edited) based on comments made to improve my posts clarity :-)
I know its out there.................. the answer - but I have tried and tried and tried to find it using seach and I cannot. Undboutedly someone will point me to the answer in another thread or FAQ.
environment: VS 2005, Sql Server Express
Language: vb.net
I have a strongly typed dataset - one created using the dataset designer - I created an INSERT (that works) until I try and insert null values. I want to be able to use a strongly typed dataset and insert null values in DECIMAL, INT, VARCHAR, and DATETIME fields The example I have provided below of things I have tried only apply for a Decimal Column.
The PROPERTY "AllowDBNull" of the paramater of my typed dataset is set to TRUE
Direction of the Paramater is set to INPUT.
What I have tried and does not work..
Method 1 -- doesnt work (casting dbnull.value to a decimal as the paramater)
See error message below
todoadapter.InsertIntoToDo( _
"aaa", _
"bbb", _
Convert.ToDecimal(DBNull.Value))
Third column in this example is a decimal error I get it:Value of type system.dbnull cannot be converted to system.nullable (of decimal)
Runtime Error: Object cannot be cast from DBNull to other types
Method 2: Doesn't Work - Using dbnull.value as the paramater
See the compile error message below
todoadapter.InsertIntoToDo( _
"aaa", _
"bbb", _
DBNull.Value)
Compile Error: Value of type 'System.DBNull' cannot be converted to 'System.Nullable(Of Decimal)'.
Method 3: Doesn't Work - using system.dbnull as a parameter -
See the compile error message below.
todoadapter.InsertIntoToDo( _
"aaa", _
"bbb", _
system.dbnull)
Compile Error: dbnull is a type in 'system' and cannot be used as an expression.
Any help appreciated strongly.
These forums are great resources by finding the answer in the ocean of answers is sometimes the problem.
Thanks in Advance
Humour