Skip to Content
0
Former Member
May 02, 2013 at 01:45 PM

Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

858 Views

Hi All,

I created a form using screen painter with some buttons, matrix ,etc.....When i click on the button the stored procedure should be executed and the result should be displayed in the columns of matrix. When i run and debug the code the stored procedure is executing and the values are displaying in the matrix. But when i create ard and i have installed in other system and i started the ard and when i click the button it is displaying the below error message like.....

" Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) "

Here is the sample code.......................

oForm = SBO_Application.Forms.Item("AIT_TRANS")

oForm.Freeze(True)

Dim pwd As String = "xxxxxxxxxxxxx"

Dim FDate As String = oForm.Items.Item("edt_FrmDat").Specific.Value

Dim TDate As String = oForm.Items.Item("edt_ToDate").Specific.Value

Dim FromDate As String = FDate.Substring(6, 2) + "/" + FDate.Substring(4, 2) + "/" + FDate.Substring(0, 4)

Dim ToDate1 As String = TDate.Substring(6, 2) + "/" + TDate.Substring(4, 2) + "/" + TDate.Substring(0, 4)

Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item("0_U_G").Specific

Dim con As SqlConnection = New SqlConnection("Data Source=" & oCompany.Server & ";Initial Catalog=" & oCompany.CompanyDB & ";User ID=" & oCompany.DbUserName & ";Password=" & pwd & "")

con.Open()

For j = 1 To oMatrix.RowCount

Dim cmd As New SqlCommand("xxxxxx", con)

cmd.CommandType = CommandType.StoredProcedure

Dim Param As SqlParameter

Param = New SqlParameter("@empid", oMatrix.Columns.Item("V_9").Cells.Item(j).Specific.Value)

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.VarChar

cmd.Parameters.Add(Param)

Param = New SqlParameter("@PDAYS", Convert.ToDouble(oMatrix.Columns.Item("V_5").Cells.Item(j).Specific.Value))

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.Float

cmd.Parameters.Add(Param)

Param = New SqlParameter("@MDAYS", Convert.ToDouble(oMatrix.Columns.Item("V_6").Cells.Item(j).Specific.Value))

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.Float

cmd.Parameters.Add(Param)

Param = New SqlParameter("@LOP", Convert.ToDouble(oMatrix.Columns.Item("V_15").Cells.Item(j).Specific.Value))

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.Float

cmd.Parameters.Add(Param)

Param = New SqlParameter("@GSALARY", Convert.ToDouble(oMatrix.Columns.Item("V_10").Cells.Item(j).Specific.Value))

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.Float

cmd.Parameters.Add(Param)

Param = New SqlParameter("@FDATE", FromDate)

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.DateTime

cmd.Parameters.Add(Param)

Param = New SqlParameter("@TDATE", ToDate1)

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.DateTime

cmd.Parameters.Add(Param)

Param = New SqlParameter("@MONTH", Trim(oForm.Items.Item("cmb_Month").Specific.Value))

Param.Direction = ParameterDirection.Input

Param.SqlDbType = SqlDbType.VarChar

cmd.Parameters.Add(Param)

cmd.CommandTimeout = 2000

Dim adapter As SqlDataAdapter

Dim ds As New DataSet

adapter = New SqlDataAdapter(cmd)

adapter.Fill(ds)

For k = 0 To ds.Tables(0).Rows.Count - 1

SBO_Application.StatusBar.SetText("Generating deductions and salary for " & oMatrix.Columns.Item("V_7").Cells.Item(j).Specific.Value & " for the month of " & Trim(oForm.Items.Item("cmb_Month").Specific.Value) & " of " & Trim(oForm.Items.Item("cmb_Branch").Specific.Value) & " branch", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)


After running the ard when i click on the button it is displaying the above message and after that it is displaying the error message like


" Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) "

and the below lines are not executing.


oMatrix.Columns.Item("V_13").Cells.Item(j).Specific.Value = ds.Tables(0).Rows(k).Item("PT")

oMatrix.Columns.Item("V_14").Cells.Item(j).Specific.Value = ds.Tables(0).Rows(k).Item("PF")

oMatrix.Columns.Item("V_12").Cells.Item(j).Specific.Value = ds.Tables(0).Rows(k).Item("ESI")

oMatrix.Columns.Item("V_16").Cells.Item(j).Specific.Value = ds.Tables(0).Rows(k).Item("LOAN")

oMatrix.Columns.Item("V_24").Cells.Item(j).Specific.Value = ds.Tables(0).Rows(k).Item("Advance")

oMatrix.Columns.Item("V_23").Cells.Item(j).Specific.Value = ds.Tables(0).Rows(k).Item("Imprest")

oMatrix.Columns.Item("V_0").Cells.Item(j).Specific.Value = (Convert.ToDecimal(oMatrix.Columns.Item("V_10").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_16").Cells.Item(j).Specific.Value)- Convert.ToDecimal(oMatrix.Columns.Item("V_24").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_23").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_15").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_14").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_13").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_12").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_22").Cells.Item(j).Specific.Value) - Convert.ToDecimal(oMatrix.Columns.Item("V_21").Cells.Item(j).Specific.Value))

Next

Next j

con.Close()