Unable to debug Null reference Exception

Feb 19 2008 6:14 AM
Hello all,
    I am am having a strange problem. I am  getting a null  reference  exception  error while retrieving data. the code is as follows:
key = Convert.ToInt64(e.KeyChar)
        Try
            If key = 13 Then
                If cmbName.Text = "" Then
                    MsgBox("Please Enter the Provider name", MsgBoxStyle.Information, "ITAC")
                End If
                con.Open()
                DbCmd = New MySqlCommand("Select IFNULL(currentST,0),IFNULL(UnpaidST,0),IFNULL(TotalST,0),IFNULL(HigherCess,0),IFNULL(PaymentsReceived,0),IFNULL(LowerCess,0),IFNULL(TaxableValue,0),IFNULL(SetoffValue,0) from MonthlyReports where Month='" & txtMon.Text & "' and Name='" & cmbName.Text & "'", con)
                DbReader = DbCmd.ExecuteReader
                If DbReader.Read Then
                    txtCurrentST.Text = DbReader.GetDecimal(0)
                    txtPreviousST.Text = DbReader.GetDecimal(1)
                    txtTotalST.Text = DbReader.GetDecimal(2) ' I am getting the error here
                    txtHigherCess.Text = DbReader.GetDecimal(3)
                    txtPaymentReceived.Text = DbReader.GetDecimal(4)
                    txtLowerCess.Text = DbReader.GetDecimal(5)
                    txtTaxableValue.Text = DbReader.GetDecimal(6)
                    txtSetOff.Text = DbReader.GetDecimal(7)
                Else
                    MsgBox("No transactions wree made for this month", MsgBoxStyle.Information, "ITAC")
                End If
                con.Close()
            End If
        Catch ex As NullReferenceException
            MsgBox(ex.Message)
        End Try

Here  I am trying to retrieve the data through key pree event
Your help would be highly appreciated
Thanks

Answers (1)