Re:[Solution] Null problem by aculfa
aculfa
Fri Jan 09 08:49:27 CST 2004
Hi,
I want to say how the problem solved..
foreach(DataColumn dc in myTypedDataSet.Tables[0].Columns
{
dc.AllowDbNull = true; /* you should set this property to
"true" */
}
Then you can insert null to columns of any type..
Without this trying to insert "null" to an integer column ends up failure...
Happy Weekend,
"aculfa" <a.culfa@belbim.com.tr> wrote in message
news:#66iuIe1DHA.1752@tk2msftngp13.phx.gbl...
> It's already like that, but I can not insert due to int datatype
> restriction..
>
> I found a nullableInt class, set my values to instances of this class. But
> when inserting , this should also be converted to int (because of typed
> dataset) and trying to convert null to int results in Zero or Error..
>
> "Miha Markic" <miha at rthand com> wrote in message
> news:OFoeh7c1DHA.1908@TK2MSFTNGP10.phx.gbl...
> > Set column's minOccurs = 0 in designer?
> >
> > --
> > Miha Markic - RightHand .NET consulting & software development
> > miha at rthand com
> > www.rthand.com
> >
> > "aculfa" <a.culfa@belbim.com.tr> wrote in message
> > news:ubZGNWb1DHA.2060@TK2MSFTNGP10.phx.gbl...
> > > Preparing the row is not the problem..
> > >
> > > The problem is, DataTable doesn't allow such an insertion. What should
> be
> > > done to insert null to datatable.
> > >
> > > We can easily do this when inserting to database..
> > >
> > >
> > > "Miha Markic" <miha at rthand com> wrote in message
> > > news:#Q$myhS1DHA.2456@TK2MSFTNGP12.phx.gbl...
> > > > Hi,
> > > >
> > > > Ah, yes, silly isn't it.
> > > > I would create a NewMyDataTableRow first and set its properties.
Only
> > then
> > > I
> > > > would add it to table.
> > > > --
> > > > Miha Markic - RightHand .NET consulting & development
> > > > miha at rthand com
> > > > www.rthand.com
> > > >
> > > > "aculfa" <a.culfa@belbim.com.tr> wrote in message
> > > > news:%23wxGMVS1DHA.2456@TK2MSFTNGP12.phx.gbl...
> > > > > We've a typed dataset which has a number of datatables.
> > > > >
> > > > > After some computing we insert rows to these datatables.
> > > > >
> > > > > My question is, we want to insert null value to an integer column
in
> > > this
> > > > > datatable. How can this be done?
> > > > >
> > > > > What should we do to do sth. like below;
> > > > >
> > > > > myTypedDataSet.myDataTable.addmyDataTableRow(strValue1,
> > > > > intValue2,
> > > > > intValue3,
> > > > > null, /*this column is an integer
> column*/
> > > > > intValue5);
> > > > >
> > > > > Thanks,
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>