humour
Programmer
- Nov 24, 2003
- 87
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 in vs2005 - I created an INSERT (that works) until I try and insert null values. <b>I want to be able to use a strongly typed dataset and insert null values in DECIMAL, INT, VARCHAR, and DATETIME fields</b> 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)
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)
Error: Value of type system.dbnull cannot be converted to system.nullable (of decimal)
Method 2: Doesn't Work - Using dbnull.value as the paramater
todoadapter.InsertIntoToDo( _
"aaa", _
"bbb", _
DBNull.Value)
Compile Error: system.dbnull is a type in 'system' and cannot be used as an expression
Method 3: Doesn't Work - using system.dbnull as a paramater
todoadapter.InsertIntoToDo( _
"aaa", _
"bbb", _
system.dbnull)
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
environment: VS 2005, Sql Server Express
Language: vb.net
I have a strongly typed dataset - one created using the dataset designer in vs2005 - I created an INSERT (that works) until I try and insert null values. <b>I want to be able to use a strongly typed dataset and insert null values in DECIMAL, INT, VARCHAR, and DATETIME fields</b> 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)
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)
Error: Value of type system.dbnull cannot be converted to system.nullable (of decimal)
Method 2: Doesn't Work - Using dbnull.value as the paramater
todoadapter.InsertIntoToDo( _
"aaa", _
"bbb", _
DBNull.Value)
Compile Error: system.dbnull is a type in 'system' and cannot be used as an expression
Method 3: Doesn't Work - using system.dbnull as a paramater
todoadapter.InsertIntoToDo( _
"aaa", _
"bbb", _
system.dbnull)
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