I trying to insert a record into my tabel. But I get this error while adding date vale into colunm.
"Type of value has a mismatch with column typeCouldn't store <2011-09-08> in Process Date Column. Expected type is MySqlDateTime."
How to avoid this error?
Try
If Process_Number_Combo_Box.Text <> Nothing And Process_DatePicker.SelectedDate.ToString <> Nothing And Process_Shift_Combo_Box.SelectedItem <> Nothing And Operator_Name_Combo_Box.SelectedItem <> Nothing And Plant_Name_Combo_Box.SelectedItem <> Nothing And Brand_Combo_Box.SelectedItem <> Nothing And Segment_Combo_Box.SelectedItem <> Nothing And Component_Combo_Box.SelectedItem <> Nothing And Color_Combo_Box.SelectedItem <> Nothing And Start_Time_Text_Box.Text <> Nothing And End_Time_Text_Box.Text <> Nothing And Total_Quantity_Text_Box.Text <> Nothing And New_Quantity_Text_Box.Text <> Nothing And Rework_Quantity_Text_Box.Text <> Nothing Then
Process_Transcation_Tabel_Data_Set = New DataSet
Process_Transcation_Tabel_Data_Adapter = New MySqlDataAdapter("SELECT * FROM Process_Transcation_Tabel WHERE `Process Number`='" & Process_Number_Combo_Box.SelectedItem & "'", MySQL_Connection)
Process_Transcation_Tabel_Command_Builder = New MySqlCommandBuilder(Process_Transcation_Tabel_Data_Adapter)
Process_Transcation_Data_Tabel = New DataTable()
Process_Transcation_Tabel_Data_Adapter.Fill(Process_Transcation_Tabel_Data_Set, "Process_Transcation_Tabel")
Process_Transcation_Data_Tabel = Process_Transcation_Tabel_Data_Set.Tables("Process_Transcation_Tabel")
Process_Transcation_Tabel_Primary_Key_Column(0) = Process_Transcation_Data_Tabel.Columns.Item("Process Number")
Process_Transcation_Data_Tabel.PrimaryKey = Process_Transcation_Tabel_Primary_Key_Column
If Process_Transcation_Data_Tabel.Rows.Count = 0 Then
Process_Transcation_Tabel_Row = Process_Transcation_Data_Tabel.NewRow()
Process_Transcation_Tabel_Row("Process Number") = Process_Number_Combo_Box.Text
Process_Transcation_Tabel_Row("Process Date") = Format(Process_DatePicker.SelectedDate, "yyyy-MM-dd")
Process_Transcation_Tabel_Row("Shift") = Process_Shift_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Operator Name") = Operator_Name_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Plant Name") = Plant_Name_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Brand") = Brand_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Segment") = Segment_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Model") = Model_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Component") = Component_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Color") = Color_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Start Time") = Start_Time_Text_Box.Text
Process_Transcation_Tabel_Row("End Time") = End_Time_Text_Box.Text
Process_Transcation_Tabel_Row("Total Quantity") = Total_Quantity_Text_Box.Text
Process_Transcation_Tabel_Row("New Quantity") = New_Quantity_Text_Box.Text
Process_Transcation_Tabel_Row("Rework Quantity") = Rework_Quantity_Text_Box.Text
Process_Transcation_Data_Tabel.Rows.Add(Process_Transcation_Tabel_Row)
Process_Transcation_Tabel_Data_Adapter.Update(Process_Transcation_Tabel_Data_Set.Tables("Process_Transcation_Tabel"))
Process_Transcation_List.ItemsSource = Process_Transcation_Data_Tabel.DefaultView
Process_Transcation_Parameter_Tabel_Data_Set = New DataSet
Process_Transcation_Parameter_Tabel_Data_Adapter = New MySqlDataAdapter("SELECT * FROM Process_Transcation_Parameter_Tabel WHERE `Process Number` = '" & Process_Number_Combo_Box.SelectedItem & "'", MySQL_Connection)
Process_Transcation_Parameter_Tabel_Command_Builder = New MySqlCommandBuilder(Process_Transcation_Parameter_Tabel_Data_Adapter)
Process_Transcation_Parameter_Data_Tabel = New DataTable()
Process_Transcation_Parameter_Tabel_Data_Adapter.Fill(Process_Transcation_Parameter_Tabel_Data_Set, "Process_Transcation_Parameter_Tabel")
Process_Transcation_Parameter_Data_Tabel = Process_Transcation_Parameter_Tabel_Data_Set.Tables("Process_Transcation_Parameter_Tabel")
Process_Transcation_Parameter_Tabel_Primary_Key_Column(0) = Process_Transcation_Parameter_Data_Tabel.Columns.Item("Process Number")
Process_Transcation_Parameter_Tabel_Primary_Key_Column(1) = Process_Transcation_Parameter_Data_Tabel.Columns.Item("Process Name")
Process_Transcation_Parameter_Tabel_Primary_Key_Column(2) = Process_Transcation_Parameter_Data_Tabel.Columns.Item("Process Parameter")
Process_Transcation_Parameter_Data_Tabel.PrimaryKey = Process_Transcation_Parameter_Tabel_Primary_Key_Column
For Each Me.Process_Transcation_Parameter_Row In Process_Transcation_Parameter_Tabel.Rows()
If Process_Transcation_Parameter_Tabel_Row("New Data") = True Then
Process_Transcation_Parameter_Tabel_Row = Process_Transcation_Parameter_Data_Tabel.NewRow()
Process_Transcation_Parameter_Tabel_Row("Process Number") = Process_Number_Combo_Box.SelectedItem
Process_Transcation_Parameter_Tabel_Row("Process Name") = Process_Name_Combo_Box.SelectedItem
Process_Transcation_Parameter_Tabel_Row("Process Parameter") = Process_Parameter_Combo_Box.SelectedItem
Process_Transcation_Parameter_Tabel_Row("Parameter Value") = Parameter_Vlaue_Text_Box.Text
Process_Transcation_Parameter_Tabel_Row("Parameter Unit") = Process_Parameter_Unit_Label.Content
Process_Transcation_Parameter_Tabel.Rows.Add(Process_Transcation_Parameter_Tabel_Row)
End If
Next
Process_Transcation_Parameter_Tabel_Data_Adapter.Update(Process_Transcation_Parameter_Tabel_Data_Set.Tables("Process_Transcation_Parameter_Tabel"))
Process_Transcation_Parameter_List.ItemsSource = Process_Transcation_Data_Tabel.DefaultView
Else
MsgBox("Process Number Exists.")
End If
Else
MsgBox("Enter all details to continue.")
End If
Catch
MsgBox("Error :" & ErrorToString())
End Try
"Type of value has a mismatch with column typeCouldn't store <2011-09-08> in Process Date Column. Expected type is MySqlDateTime."
How to avoid this error?
Try
If Process_Number_Combo_Box.Text <> Nothing And Process_DatePicker.SelectedDate.ToString <> Nothing And Process_Shift_Combo_Box.SelectedItem <> Nothing And Operator_Name_Combo_Box.SelectedItem <> Nothing And Plant_Name_Combo_Box.SelectedItem <> Nothing And Brand_Combo_Box.SelectedItem <> Nothing And Segment_Combo_Box.SelectedItem <> Nothing And Component_Combo_Box.SelectedItem <> Nothing And Color_Combo_Box.SelectedItem <> Nothing And Start_Time_Text_Box.Text <> Nothing And End_Time_Text_Box.Text <> Nothing And Total_Quantity_Text_Box.Text <> Nothing And New_Quantity_Text_Box.Text <> Nothing And Rework_Quantity_Text_Box.Text <> Nothing Then
Process_Transcation_Tabel_Data_Set = New DataSet
Process_Transcation_Tabel_Data_Adapter = New MySqlDataAdapter("SELECT * FROM Process_Transcation_Tabel WHERE `Process Number`='" & Process_Number_Combo_Box.SelectedItem & "'", MySQL_Connection)
Process_Transcation_Tabel_Command_Builder = New MySqlCommandBuilder(Process_Transcation_Tabel_Data_Adapter)
Process_Transcation_Data_Tabel = New DataTable()
Process_Transcation_Tabel_Data_Adapter.Fill(Process_Transcation_Tabel_Data_Set, "Process_Transcation_Tabel")
Process_Transcation_Data_Tabel = Process_Transcation_Tabel_Data_Set.Tables("Process_Transcation_Tabel")
Process_Transcation_Tabel_Primary_Key_Column(0) = Process_Transcation_Data_Tabel.Columns.Item("Process Number")
Process_Transcation_Data_Tabel.PrimaryKey = Process_Transcation_Tabel_Primary_Key_Column
If Process_Transcation_Data_Tabel.Rows.Count = 0 Then
Process_Transcation_Tabel_Row = Process_Transcation_Data_Tabel.NewRow()
Process_Transcation_Tabel_Row("Process Number") = Process_Number_Combo_Box.Text
Process_Transcation_Tabel_Row("Process Date") = Format(Process_DatePicker.SelectedDate, "yyyy-MM-dd")
Process_Transcation_Tabel_Row("Shift") = Process_Shift_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Operator Name") = Operator_Name_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Plant Name") = Plant_Name_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Brand") = Brand_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Segment") = Segment_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Model") = Model_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Component") = Component_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Color") = Color_Combo_Box.SelectedItem
Process_Transcation_Tabel_Row("Start Time") = Start_Time_Text_Box.Text
Process_Transcation_Tabel_Row("End Time") = End_Time_Text_Box.Text
Process_Transcation_Tabel_Row("Total Quantity") = Total_Quantity_Text_Box.Text
Process_Transcation_Tabel_Row("New Quantity") = New_Quantity_Text_Box.Text
Process_Transcation_Tabel_Row("Rework Quantity") = Rework_Quantity_Text_Box.Text
Process_Transcation_Data_Tabel.Rows.Add(Process_Transcation_Tabel_Row)
Process_Transcation_Tabel_Data_Adapter.Update(Process_Transcation_Tabel_Data_Set.Tables("Process_Transcation_Tabel"))
Process_Transcation_List.ItemsSource = Process_Transcation_Data_Tabel.DefaultView
Process_Transcation_Parameter_Tabel_Data_Set = New DataSet
Process_Transcation_Parameter_Tabel_Data_Adapter = New MySqlDataAdapter("SELECT * FROM Process_Transcation_Parameter_Tabel WHERE `Process Number` = '" & Process_Number_Combo_Box.SelectedItem & "'", MySQL_Connection)
Process_Transcation_Parameter_Tabel_Command_Builder = New MySqlCommandBuilder(Process_Transcation_Parameter_Tabel_Data_Adapter)
Process_Transcation_Parameter_Data_Tabel = New DataTable()
Process_Transcation_Parameter_Tabel_Data_Adapter.Fill(Process_Transcation_Parameter_Tabel_Data_Set, "Process_Transcation_Parameter_Tabel")
Process_Transcation_Parameter_Data_Tabel = Process_Transcation_Parameter_Tabel_Data_Set.Tables("Process_Transcation_Parameter_Tabel")
Process_Transcation_Parameter_Tabel_Primary_Key_Column(0) = Process_Transcation_Parameter_Data_Tabel.Columns.Item("Process Number")
Process_Transcation_Parameter_Tabel_Primary_Key_Column(1) = Process_Transcation_Parameter_Data_Tabel.Columns.Item("Process Name")
Process_Transcation_Parameter_Tabel_Primary_Key_Column(2) = Process_Transcation_Parameter_Data_Tabel.Columns.Item("Process Parameter")
Process_Transcation_Parameter_Data_Tabel.PrimaryKey = Process_Transcation_Parameter_Tabel_Primary_Key_Column
For Each Me.Process_Transcation_Parameter_Row In Process_Transcation_Parameter_Tabel.Rows()
If Process_Transcation_Parameter_Tabel_Row("New Data") = True Then
Process_Transcation_Parameter_Tabel_Row = Process_Transcation_Parameter_Data_Tabel.NewRow()
Process_Transcation_Parameter_Tabel_Row("Process Number") = Process_Number_Combo_Box.SelectedItem
Process_Transcation_Parameter_Tabel_Row("Process Name") = Process_Name_Combo_Box.SelectedItem
Process_Transcation_Parameter_Tabel_Row("Process Parameter") = Process_Parameter_Combo_Box.SelectedItem
Process_Transcation_Parameter_Tabel_Row("Parameter Value") = Parameter_Vlaue_Text_Box.Text
Process_Transcation_Parameter_Tabel_Row("Parameter Unit") = Process_Parameter_Unit_Label.Content
Process_Transcation_Parameter_Tabel.Rows.Add(Process_Transcation_Parameter_Tabel_Row)
End If
Next
Process_Transcation_Parameter_Tabel_Data_Adapter.Update(Process_Transcation_Parameter_Tabel_Data_Set.Tables("Process_Transcation_Parameter_Tabel"))
Process_Transcation_Parameter_List.ItemsSource = Process_Transcation_Data_Tabel.DefaultView
Else
MsgBox("Process Number Exists.")
End If
Else
MsgBox("Enter all details to continue.")
End If
Catch
MsgBox("Error :" & ErrorToString())
End Try