|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
strange things with adonet 2.0 abstract DataObjectsi 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?? 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? 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?? |
|||||||||||||||||||||||