Oh, I'm sorry. I didn't think long enough about what you wrote.
You are working with a typed dataset, so there is some "automagic" code
generation done for you to allow those columns to be strongly typed. That
works great when the columns aren't nullable. Unfortunately, they don't
deal well with DBNull values. Annoying, huh?
You can do this instead:
insertRow["GLCode"] = System.DBNull.Value;
Thus, you are using the string-based array indexer to get a reference to
the column in question. This is a feature of the DataRow class which is a
base class of your row's class, so this capability is inherited. It's
perfectly happy with DBNull.Value.
Cheers!
--JV
"Tina" <ti**********@removespamexcite.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I tried that too: Value of type "System.dbnull" cannot be converted to
'String'
is the compile error.
T
"JV" <jo**********@goisc.com> wrote in message
news:e3**************@TK2MSFTNGP15.phx.gbl... insertRow.GLCode = System.DBNull.Value;
"Tina" <ti**********@removespamexcite.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...I have instantiated an insertRow for a dataset. I now want to make the
GLCode DBNull.
I have tried:
insertRow.GLCode = Convert.dbnull
insertRow.GLCode = Convert.dbnull(insertRow.GLCode)
and several other things.
How is it done?