G
Guest
Hi,
Im pretty new to ADO.net and I ran into the following problem:
I try to add a row to a DataSet that has NotNull-Constraints on its columns.
When doing:
DataRow row = ds.Tables["docdescriptors"].NewRow();
DocTypeDB dt = new DocTypeDB(row);
NpgsqlCommand command = new NpgsqlCommand("select
nextval('docdescriptor_id_seq')", connection);
row["id"] = (int)(Int64)command.ExecuteScalar();
ds.Tables["docdescriptors"].Rows.Add(row);
I get the a ConstraintException because I did not fill all columns. That's
ok so far. But following the documentaion I added a BeginEdit
DataRow row = ds.Tables["docdescriptors"].NewRow();
row.BeginEdit();
DocTypeDB dt = new DocTypeDB(row);
NpgsqlCommand command = new NpgsqlCommand("select
nextval('docdescriptor_id_seq')", connection);
row["id"] = (int)(Int64)command.ExecuteScalar();
ds.Tables["docdescriptors"].Rows.Add(row);
But I still get the Exception I try to add the Row to the table.
Best
Thomas
Im pretty new to ADO.net and I ran into the following problem:
I try to add a row to a DataSet that has NotNull-Constraints on its columns.
When doing:
DataRow row = ds.Tables["docdescriptors"].NewRow();
DocTypeDB dt = new DocTypeDB(row);
NpgsqlCommand command = new NpgsqlCommand("select
nextval('docdescriptor_id_seq')", connection);
row["id"] = (int)(Int64)command.ExecuteScalar();
ds.Tables["docdescriptors"].Rows.Add(row);
I get the a ConstraintException because I did not fill all columns. That's
ok so far. But following the documentaion I added a BeginEdit
DataRow row = ds.Tables["docdescriptors"].NewRow();
row.BeginEdit();
DocTypeDB dt = new DocTypeDB(row);
NpgsqlCommand command = new NpgsqlCommand("select
nextval('docdescriptor_id_seq')", connection);
row["id"] = (int)(Int64)command.ExecuteScalar();
ds.Tables["docdescriptors"].Rows.Add(row);
But I still get the Exception I try to add the Row to the table.
Best
Thomas