2 Aug 12 8:30
If I have null in the tabel the objReader has issues I can't seem to do anything to passify it.
Can't look at it for a NULL cause it can't conatin a NULL and errors no matter what I do.
how do I get around this I just want to put data in text boxes. can some one give me a code snippet , Please. It's having trouble with a Date being Null. Is there something I can put in the DAte field to make it happy. we are trying sto come up with a date that is eitehr 1900 or 2100, so far out then have to check for it. But I have to update all the records. I would prefer to handle the Nulls with this reader. Or can I put something into the SQL string so it returns something other than Null?
Also note I left out some of the = objReader.GetString(x) lines below to save space.
Error >>>>> Data is Null. this property or method cannot be called on Null values.
Dim queryTrans As String
queryTrans = "SELECT ResourceLastname, ResourceFirstname, Manager, " & _
"ResourceType, [Offshore-OnShore], Vendor, SOWTracker, StartDate, " & _
" EndDate, email,intUserId From SOWResources " & _
"WHERE ResourceLastname = '" & Lname & "' " & _
"AND ResourceFirstname = '" & Fname & "'
Dim strConn As New SqlConnection(connStr)
Dim objComm As SqlCommand
Dim objReader As SqlDataReader
objComm = New SqlCommand(queryTrans, strConn)
objReader = objComm.ExecuteReader()
If objReader.HasRows Then
Do While objReader.Read()
Me.txtResourceLastname.Text = objReader.GetString(0)
Me.txtResourceFirstname.Text = objReader.GetString(1)
Me.ddlManagerName.Text = objReader.GetString(2)
Me.txtResourceType.Text = objReader.GetString(3)
Me.ddlShore.Text = objReader.GetString(4)
Me.txtEndDate.Text = objReader.GetString(8) ' ERROR here the End date is null
' Me.ddlVendor.Text = TheVendor.ToString