| Bug #6159 | BUG in MySqlDataAdapter.Fill and MySqlDataReader.Read() Duplicate DBNull Value | ||
|---|---|---|---|
| Submitted: | 19 Oct 2004 16:25 | Modified: | 21 Oct 2004 0:56 |
| Reporter: | ale pac | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 1.0.0 | OS: | Windows (Windows XP) |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
[19 Oct 2004 17:35]
ale pac
<<<<<<<<<<< solution <<<<<<
To Solve this problem
Add Code
colValue.IsNull = false;
in function
public virtual void SetTextData
in file Field.Cs
public virtual void SetTextData( ...
{
if (len == -1)
{
..... // Set IsNull To True
}
colValue.IsNull = false; // Set Is Null To False
and the same for Function
SetBinaryData(
in file
Field41.cs
[21 Oct 2004 0:56]
Reggie Burnett
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead. Thank you for your interest in MySQL. Additional info: This bug has already been reported and fixed.

Description: BUG in MySqlDataAdapter.Fill and MySqlDataReader.Read() Duplicate DBNull Value infact if on first record I Found DbNull on FieldX also in all other record I Found DbNull on FieldX How to repeat: Build a Table TabTest With int Id, Field1 VarChar, Field2 VarChar insert Id=0, Field1 'Test1', Field 2 ' Test2' insert Id=1, Field1 Null, Field 2 Null insert Id=2, Field1 'Test1', Field 2 ' Test2' insert Id=3, Field1 Null, Field 2 Null Put a Grid on a WebForm and Put this code (changing Connection string) private void Page_Load(object sender, System.EventArgs e) { string sSql = "SELECT * FROM `tabTest` order by id"; MySql.Data.MySqlClient.MySqlConnection oConn = new MySql.Data.MySqlClient.MySqlConnection("server=192.168.1.30;user id=sa;database=crm;password=sa; max pool size=10; connection lifetime=5;"); MySql.Data.MySqlClient.MySqlCommand oCmd = new MySql.Data.MySqlClient.MySqlCommand(sSql, oConn); MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter(oCmd); System.Data.DataTable dt = new System.Data.DataTable(); da.Fill(dt); DataGrid1.DataSource = dt; DataGrid1.DataBind(); } Run And you can see only 'Test 1' Record