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:
None 
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

[1 Dec 2006 23:56] Christian Benner
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.
[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

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 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.