Kul B 0 Newbie Poster

Data type mismatch in criteria expression.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Data type mismatch in criteria expression.

Source Error:


Line 280: mycommand.Parameters.Add("@UNIT", OleDbType.VarChar, 10).Value = UNITDDL.SelectedItem.Value
Line 281: mycommand.Parameters.Add("@UNIT", OleDbType.VarChar, 50).Value = UNITDDL.SelectedItem.Text
Line 282: mycommand.ExecuteNonQuery()
Line 283: OleDbConnection1.Close()
Line 284:

Private Sub savebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancelbtn.Click
OleDbConnection1.Open()
Dim mycommand As System.Data.OleDb.OleDbCommand = New OleDbCommand

mycommand.CommandText = "insert into invenACT([RAW_MATERIAL],[COMPONENTS],[STORES & SPARES],[SCRAP & OTHERS],[S_I_T],[T_I_T],[MATERIAL_ WITH _FABRICATORS],[MATERIAL INVENTORY],[W_I_P],[FINISHED GOODS_P],[FINISHED GOODS_C],[PRODUCTION_INV],[TOTAL_ INVENTORY],[TURN OVER_OF _THE _YEAR],[PERF NO_ OF_DAYS_ INV],[TURN OVER FOR NEXT_ YAER],[PERF_NO_OF_DAYS_NEXT_YEAR]) VALUES ( '" & RAWMATERIALTXT.Text & "','" & COMPONENTSTXT.Text & "','" & STORESTXT.Text & "','" & SCRAPTXT.Text & "','" & SITTXT.Text & "','" & TITTXT.Text & "','" & MATWITHFABRICATORTXT.Text & "','" & SUBTOTALTXT.Text & "','" & WIPTXT.Text & "','" & FINISHEDGOODSPTXT.Text & "','" & FINISHEDGOODSCTXT.Text & "',' PRODUCTIONINVENTORYLBL.text ','" & TOTALINVENTORYTXT.Text & "','" & TURNOVERTHISYEARTXT.Text & "','" & PERFNOOFDAYSTXT.Text & "','" & TURNOVER_NEXTYEARTXT.Text & "','" & PERFNOOFDAYSNEXTYEARTXT.Text & "')"
mycommand.Connection = OleDbConnection1
mycommand.CommandType = CommandType.Text


mycommand.Parameters.Add("@MONTH", OleDbType.VarChar, 10).Value = MONTHDDL.SelectedItem.Value
mycommand.Parameters.Add("@MONTH", OleDbType.VarChar, 50).Value = MONTHDDL.SelectedItem.Text

mycommand.Parameters.Add("@YEAR", OleDbType.VarChar, 10).Value = YEARDDL.SelectedItem.Value
mycommand.Parameters.Add("@YEAR", OleDbType.VarChar, 50).Value = YEARDDL.SelectedItem.Text


mycommand.Parameters.Add("@UNIT", OleDbType.VarChar, 10).Value = UNITDDL.SelectedItem.Value
mycommand.Parameters.Add("@UNIT", OleDbType.VarChar, 50).Value = UNITDDL.SelectedItem.Text
mycommand.ExecuteNonQuery()
OleDbConnection1.Close()

End Sub
:mad: :cry:

Be a part of the DaniWeb community

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