| Bug #24765 | Retrieving empty fields results in check for isDBNull | ||
|---|---|---|---|
| Submitted: | 1 Dec 2006 23:56 | Modified: | 8 Dec 2006 12:43 |
| Reporter: | Christian Benner | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | Connector / NET | Severity: | S1 (Critical) |
| Version: | 5.0.2 | OS: | Windows (W2K SRV) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | .NET Connector 5.0.2 isDBNull | ||
[8 Dec 2006 12:43]
Tonci Grgin
Hi Christian and thanks for your problem report.
Consider following sample (works):
MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "DataSource=localhost;Database=test;UserID=root;Password=;PORT=3306;Allow Zero Datetime=true;pooling=False;logging=True";
conn.Open();
MySqlCommand command = new MySqlCommand();
command.CommandText = "SELECT '' AS a";
command.CommandType = CommandType.Text;
command.Connection = (MySqlConnection)conn;
MySqlDataReader dr = command.ExecuteReader();
dr.Read();
MessageBox.Show(dr.GetName(0));
MessageBox.Show(dr.GetString(dr.GetOrdinal("a")));
dr.Close();
MessageBox.Show("Ready");
command.Dispose();
conn.Close();
If you can provide me with more info and a test case, please reopen this report.
Environment:
- MySQL server 5.0.27BK on WinXP Pro SP2 localhost
- NET FW 2.0
- VS2005 pro
- c/NET latest sources

Description: If fields in a table are set to "" (empty) and NOT to "NULL" the .NET Connector 5.0.2 reports a SqlNullValueException. This is right for null fields but except for empty fields. Server version is 5.0.20-nt-max-log .NET Connector is 5.0.2 VStudio 2005 prof. engine for db is MyISAM I'd checked it on two different Servers. 'test=myData.GetString(myData.GetOrdinal("fieldname")) How to repeat: create an row with empty "" fields.