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
Try
con.ConnectionString = "Data Source=" & ServerV & ";Initial Catalog=" & databaseV & ";Persist Security Info=True;User ID=" & usernameV & ";Password=" & passwordV & ""
con.Open()
cmd.Connection = con
cmd.CommandText = "ClaimTotal"
cmd.CommandType = CommandType.StoredProcedure
Dim number1Param As New SqlParameter("@Ctotal", SqlDbType.Money, 4)
number1Param.Direction = ParameterDirection.Output
cmd.Parameters.Add(number1Param)
Dim reader As SqlDataReader = cmd.ExecuteReader()
Me.lbtotal.Text = Convert.ToDouble(number1Param.Value)
Catch ex As Exception
MessageBox.Show("Unable to get Claim Total")
Finally
con.Close()
End Try
End Sub