daniness
Well-known member
- Joined
- Feb 12, 2010
- Messages
- 49
- Programming Experience
- Beginner
Hello All,
I would greatly appreciate your assistance with this issue. I'm trying to concatenate nonnull multiple columns from a database into the text property of a combobox. Right now, I'm receiving an "IndexOutOfRangeException was unhandled name, address1, address2". The line in red is where the error is occurring. Here is my code for this section:
I would greatly appreciate your assistance with this issue. I'm trying to concatenate nonnull multiple columns from a database into the text property of a combobox. Right now, I'm receiving an "IndexOutOfRangeException was unhandled name, address1, address2". The line in red is where the error is occurring. Here is my code for this section:
VB.NET:
Dim drFreight As SqlDataReader = cmdCorrespFreight.ExecuteReader
While drFreight.Read()
'If "address3" <> "" Then
If IsDBNull(drFreight("address3")) Then
cboFreight.Text = drFreight("name" & ", " & "address1" & ", " & "address2" & ", " & "address3")
'If "address4" <> "" Then
If IsDBNull(drFreight("address4")) Then
cboFreight.Text = drFreight("name" & ", " & "address1" & ", " & "address2" & ", " & "address3" & ", " & "address4")
End If
Else
[COLOR="Red"]cboFreight.Text = drFreight("name" & ", " & "address1" & ", " & "address2") [/COLOR]
End If
End While
drFreight.Close()