Bug #8292 GROUP BY / WITH ROLLUP with DataSet causes System.Data.ConstraintException
| Submitted: | 3 Feb 2005 15:57 | Modified: | 27 Jan 2006 15:42 |
|---|---|---|---|
| Reporter: | vincent ugenti | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 1.0.4 | OS: | Windows (Windows 2000) |
| Assigned to: | Reggie Burnett | CPU Architecture: | Any |
[3 Feb 2005 15:57]
vincent ugenti
[26 Feb 2005 4:49]
Reggie Burnett
I think you are loading data into a typed dataset. If so, then you are responsible for making sure the constraints in your dataset are appropriate for the data that is being inserted.
Here is a unit test that I just wrote for this and it works great. You'll see that the null value comes back and can be checked for without trouble.
[Test]
public void Rollup()
{
execSQL("DROP TABLE IF EXISTS test");
execSQL("CREATE TABLE test ( id INT NOT NULL, amount INT )");
execSQL("INSERT INTO test VALUES (1, 44)");
execSQL("INSERT INTO test VALUES (2, 88)");
MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test GROUP BY id WITH ROLLUP", conn);
DataSet ds = new DataSet();
da.Fill(ds);
Assert.AreEqual(1, ds.Tables.Count);
Assert.AreEqual(3, ds.Tables[0].Rows.Count);
Assert.AreEqual(88, ds.Tables[0].Rows[2]["amount"]);
Assert.AreEqual(DBNull.Value, ds.Tables[0].Rows[2]["id"]);
}
[27 Jan 2006 15:42]
vincent ugenti
You're right, by not calling DataAdapter.FillSchema to create a strongly typed dataset, you can use DataAdapter.Fill safely and then check for the DBNull.Value.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.