Hi,

I have the following code;

Code:
  Dim Notes As String

        Dim Prac_Req As New System.Data.SqlClient.SqlCommand(("Select prac_no, prac_enabled, notes From dbo.TblPracExclude where Prac_no = " & _
                           DgvPracExcl.Rows(e.RowIndex).Cells(0).Value), conn)
        Try
            Using Autoreader As System.Data.SqlClient.SqlDataReader = Prac_Req.ExecuteReader()
                While Autoreader.Read()

                    prac_no = Autoreader.GetValue(0)
                    prac_enabled = Autoreader.GetValue(1)
                    Notes = FixNull(Autoreader.GetValue(2))


                End While
            End Using
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "VeriSIS2")
        End Try


        If prac_no = DgvPracExcl.Rows(e.RowIndex).Cells(0).Value And prac_enabled = DgvPracExcl.Rows(e.RowIndex).Cells(4).Value And  Notes = DgvPracExcl.Rows(e.RowIndex).Cells(5).Value Then
            'MsgBox("No Practice need Update", MsgBoxStyle.Information, "VeriSIS")
        Else
.............................

1) Notes filed is underlined in green with a warning - Variable 'Notes' is used before it has been assigned a value. A null reference exception could result at runtime. Note: Notes field has NULL values.
2) At runtime, I receive the error - InvalidCastException was unhandled. Operator '=' is not defined for String "" and type 'DBNull'
Notes = DgvPracExcl.Rows(e.RowIndex).Cells(5).Value

Any help please