i have the following code which works fine where there is data in the table.

when the table is empty and there is no data in the @Ctotal varible i get my error

MessageBox.Show("Unable to get Claim Total")

is there anyway i can ignore this if there isn't a value in the @ctotal?

Private Sub Gettotal()
        Dim con As New SqlConnection
        Dim cmd As New SqlCommand
            con.ConnectionString = "Data Source=" & ServerV & ";Initial Catalog=" & databaseV & ";Persist Security Info=True;User ID=" & usernameV & ";Password=" & passwordV & ""
            cmd.Connection = con
            cmd.CommandText = "ClaimTotal"
            cmd.CommandType = CommandType.StoredProcedure

            Dim number1Param As New SqlParameter("@Ctotal", SqlDbType.Money, 4)
            number1Param.Direction = ParameterDirection.Output

            Dim reader As SqlDataReader = cmd.ExecuteReader()

            Me.lbtotal.Text = Convert.ToDouble(number1Param.Value)
        Catch ex As Exception

            MessageBox.Show("Unable to get Claim Total")
        End Try

    End Sub

i do not know if i am right, i normally add an isnull into a query, but i beleive in .net it is

if string.isnullorempty 
do what if it is nothing
do what if it is something
end if

that could be wrong though.

if number1param.value is dbnull.value then
  lbltotal.text = "0"
  lbltotal.text = cdbl(number1param.value).tostring
thanks, i wasnt positive
This article has been dead for over six months. Start a new discussion instead.