Hello guys
Please help me about this error. When i hit the save button it gives me error
"failed to convert parameter value from a string to decimal".
Here is my code

Dim cnSQL As New SqlConnection(con)
        cnSQL.Open()
        Dim cmd As SqlCommand = cnSQL.CreateCommand()
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "sp_InsertPNB"

        Dim param() As SqlParameter = New SqlParameter(6) {}
        param(0) = New SqlParameter("emp_code", SqlDbType.NChar)
        param(0).Value = txtempno.Text
        cmd.Parameters.Add(param(0))

        param(1) = New SqlParameter("polnum", SqlDbType.VarChar)
        param(1).Value = txtPolicyNo.Text
        cmd.Parameters.Add(param(1))

        param(2) = New SqlParameter("strt_date", SqlDbType.SmallDateTime)
        param(2).Value = dtpStrtPNB.Value.Date
        cmd.Parameters.Add(param(2))

        param(3) = New SqlParameter("req", SqlDbType.SmallMoney)
        param(3).Value = txtPNBReq.Text
        cmd.Parameters.Add(param(3))

        Dim num As Integer
        Integer.TryParse(cmbPNBins.Text.Split("-")(0), num)
        param(4) = New SqlParameter("inst", SqlDbType.SmallInt)
        param(4).Value = num
        cmd.Parameters.Add(param(4))

        param(5) = New SqlParameter("balance", SqlDbType.SmallMoney)
        param(5).Value = txtPNBBal.Text
        cmd.Parameters.Add(param(5))

        Try
            cmd.ExecuteNonQuery()
            cnSQL.Close()
            cnSQL.Dispose()
            cmd.Dispose()
            MessageBox.Show("Employee NYLife successfully save/update", "Prompt")
        Catch ex As Exception
            MessageBox.Show(ex.Message.ToString(), "Data Error")
            Exit Sub
        End Try

Any comments are appreciated.
Thanks in advance

perhaps you need to check the data types of each of the elements in the table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.