Bug #68924 Null Items cause further data not to be returned
| Submitted: | 10 Apr 2013 21:40 | Modified: | 27 May 2013 20:52 |
|---|---|---|---|
| Reporter: | O'Brien Donal | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 6.6.4.0 | OS: | Windows (Win 7 Pro, Vis Studio 2012) |
| Assigned to: | Roberto Ezequiel Garcia Ballesteros | CPU Architecture: | Any |
[27 May 2013 20:52]
Roberto Ezequiel Garcia Ballesteros
Hi, I changed the status to "Not a bug" since the behavior is as designed. When you try to read a database null value, it throws an System.Data.SqlTypes.SqlNullValueException. I suggest to use MySqlDataReader.IsDBNull() to check for null values before use GetString(). You can find more information about this in the following link (please check Remark section): http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.DATA.SQLCL... The library link is for SqlDataReader but it works the same way in MySqlDataReader. Regards.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 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.
Description: VB in Visual Studio 2012 Query of format Select Item1,Item2,Item3,Item4,Item5,Item6 From Table with a WHERE clause which will only return 1 row If, for example the returned record has Item4 = NULL Item5 and Item6 are not returned, If Item2 = NULL, Items 3 to 6 are not returned, Am I doing something wrong ? Actual code for this is below How to repeat: Actual Code Private Sub GetRecord(rownum As Integer) Try Dim query As String = "SELECT CtrlType, Search, Alpha2, Alpha1, Numeric1, Numeric2" query = query + " FROM control WHERE CtlFileNo = " + rownum.ToString Dim connection As New MySqlConnection(connStr) connection.Open() Dim sqlCommand = New MySqlCommand sqlCommand.CommandText = query sqlCommand.Connection = connection Dim sqlReader As MySqlDataReader sqlReader = sqlCommand.ExecuteReader sqlReader.Read() ComboBoxType1.SelectedIndex = sqlReader.GetInt32(0) - 1 TextBoxSearch.Text = sqlReader.GetString(1) TextBoxDescrip.Text = sqlReader.GetString(2) TextBoxCode.Text = sqlReader.GetString(3) MaskedTextBoxNum1.Text = sqlReader.GetDecimal(4) MaskedTextBoxNum2.Text = sqlReader.GetDecimal(5) sqlReader.Close() connection.Close() Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub