Home All Groups Group Topic Archive Search About

strange things with adonet 2.0 abstract DataObjects

Author
19 Jan 2006 10:19 PM
Elhanan
hi...

i have a typed a dataset which i'm trying to load with data using
IDataAdapter:
               IDbDataAdapter a = GetFactory().CreateDataAdapter();
            a.SelectCommand = cmd;
            RMDataSet ds = new RMDataSet();
            a.Fill(ds);

problem is that instead of filling the table i wanted to fill, the
adapter creates ANOTHER table by the name of 'table' in the dataset.


further more if i try to use:
using (IDataReader reader = cmd.ExecuteReader())
            {
                dt.Load(reader);
                reader.Close();
            }

i get an exception on the load method becouse it says i'm trying to
vaiolate constraints, if i remove a allowDBnull =false from one of the
fields, it passes but that field HAS  value
what's going on??

Author
19 Jan 2006 11:06 PM
Patrik L=f6wendahl [C# MVP]
Hello Elhanan,

For your first question, try this:

a.Fill(ds, "yourtablename");

Your second question sounds odd. Is it a string field with a dbnull default
value set on it? Or are you certain that the db holds a value for that field?

--
Patrik Löwendahl [C# MVP]
http://www.lowendahl.net

Show quote
> hi...
>
> i have a typed a dataset which i'm trying to load with data using
> IDataAdapter:
> IDbDataAdapter a = GetFactory().CreateDataAdapter();
> a.SelectCommand = cmd;
> RMDataSet ds = new RMDataSet();
> a.Fill(ds);
> problem is that instead of filling the table i wanted to fill, the
> adapter creates ANOTHER table by the name of 'table' in the dataset.
>
> further more if i try to use:
> using (IDataReader reader = cmd.ExecuteReader())
> {
> dt.Load(reader);
> reader.Close();
> }
> i get an exception on the load method becouse it says i'm trying to
> vaiolate constraints, if i remove a allowDBnull =false from one of the
> fields, it passes but that field HAS  value
> what's going on??
Author
20 Jan 2006 12:11 PM
Elhanan
i can't a is iDataAdapter and it's fill method only has one argument


as for my second questions, it's a decimal field , becouse if i use the
read method just before the load method i see the value.

AddThis Social Bookmark Button