pls some one help me... i use 3 tables with different column..and it all listed inside the save button...
it just executed but nothing is change when i click save to save the changes i made plsss help me some one ..base on my code do i missing codes to fix it?
i am using MYSQL database and VB
What I have tried:
Private Sub PictureBox2_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox2.Click
Try
If Label25.Text = "UPDATE" Then
PictureBox7.Enabled = False
Label24.Enabled = False
enabledID()
cboSSS.Checked = True
cboBIR.Checked = True
cboPag.Checked = True
cbophil.Checked = True
Label25.Text = "SAVE"
ElseIf Label25.Text = "SAVE" Then
conn.Open()
query = New MySqlCommand("UPDATE info_info SET employee_count1=@employee_count1,employee_ID=@employee_ID,month=@month,days=@days,year=@year,Name=@Name,position=@position,regular=@regular,totalday=@totalday,month1=@month1,day1=@day1,month2=@month2,day2=@day2,percent=@percent,amount=@amount,percent1=@percent1,amount1=@amount1,percent2=@percent2,amount2=@amount2,percent3=@percent3,amount3=@amount3,overtime=@overtime,holiday=@holiday,special=@special,total=@total,deduction=@deduction+1,date1=@date1,cash_advance=@cash_advance,net=@net,late=@late,under_time=@under_time,absent=@absent where employee_count1=@employee_count1", conn)
query.Parameters.AddWithValue("@employee_count1", gen)
query.Parameters.AddWithValue("@employee_ID", txtID.Text)
query.Parameters.AddWithValue("@month", txtmonth.Text)
query.Parameters.AddWithValue("@days", txtdays.Text)
query.Parameters.AddWithValue("@year", txtyear.Text)
query.Parameters.AddWithValue("@Name", txtlastname.Text)
query.Parameters.AddWithValue("@position", txtposition.Text)
query.Parameters.AddWithValue("@regular", txtregular.Text)
query.Parameters.AddWithValue("@totalday", txtotot.Text)
query.Parameters.AddWithValue("@month1", txtfrom.Text)
query.Parameters.AddWithValue("@day1", txtfrom1.Text)
query.Parameters.AddWithValue("@month2", txtto.Text)
query.Parameters.AddWithValue("@day2", txtto1.Text)
query.Parameters.AddWithValue("@percent", txtcent.Text)
query.Parameters.AddWithValue("@amount", txttot.Text)
query.Parameters.AddWithValue("@percent1", txtcent1.Text)
query.Parameters.AddWithValue("@amount1", txttot1.Text)
query.Parameters.AddWithValue("@percent2", txtcent2.Text)
query.Parameters.AddWithValue("@amount2", txttot2.Text)
query.Parameters.AddWithValue("@percent3", txtcent3.Text)
query.Parameters.AddWithValue("@amount3", txttot33.Text)
query.Parameters.AddWithValue("@overtime", txtovt.Text)
query.Parameters.AddWithValue("@holiday", txtper.Text)
query.Parameters.AddWithValue("@special", txtsped.Text)
query.Parameters.AddWithValue("@total", txtnon.Text)
query.Parameters.AddWithValue("@deduction", txtamount.Text)
query.Parameters.AddWithValue("@date1", txtday2.Text)
query.Parameters.AddWithValue("@cash_advance", txtcash.Text)
query.Parameters.AddWithValue("@net", txtnet.Text)
query.Parameters.AddWithValue("@late", txtabsent.Text)
query.Parameters.AddWithValue("@under_time", txtunder.Text)
query.Parameters.AddWithValue("@absent", txtlate.Text)
query.ExecuteNonQuery()
conn.Close()
conn.Open()
query2 = New MySqlCommand("UPDATE deduction_table SET employee_count3=@employee_count3,employee_ID=@employee_ID,month=@month,days=@days,year=@year,Name=@Name,SSS=@SSS,BIR=@BIR,Pag_ibig=@Pag_ibig,Philhealth=@Philhealth where employee_count3=@employee_count3", conn)
query2.Parameters.AddWithValue("@employee_count3", gen)
query2.Parameters.AddWithValue("@employee_ID", txtID.Text)
query2.Parameters.AddWithValue("@month", txtmonth.Text)
query2.Parameters.AddWithValue("@days", txtdays.Text)
query2.Parameters.AddWithValue("@year", txtyear.Text)
query2.Parameters.AddWithValue("@Name", txtlastname.Text)
query2.Parameters.AddWithValue("@SSS", txttot.Text)
query2.Parameters.AddWithValue("@BIR", txttot1.Text)
query2.Parameters.AddWithValue("@Pag_ibig", txttot2.Text)
query2.Parameters.AddWithValue("@Philhealth", txttot33.Text)
query2.ExecuteNonQuery()
conn.Close()
conn.Open()
query3 = New MySqlCommand("UPDATE netpay_table SET employee_count4=@employee_count4,employee_ID=@employee_ID,month=@month,days=@days,year=@year,Name=@Name,net=@net where employee_count4=@employee_count4", conn)
query3.Parameters.AddWithValue("@employee_count4", gen)
query3.Parameters.AddWithValue("@employee_ID", txtID.Text)
query3.Parameters.AddWithValue("@month", txtmonth.Text)
query3.Parameters.AddWithValue("@days", txtdays.Text)
query3.Parameters.AddWithValue("@year", txtyear.Text)
query3.Parameters.AddWithValue("@Name", txtlastname.Text)
query3.Parameters.AddWithValue("@net", txtnet.Text)
query3.ExecuteNonQuery()
conn.Close()
disabledID()
Label25.Text = "UPDATE"
MsgBox("successfully save")
generalID()
Label24.Enabled = True
PictureBox7.Enabled = True
End If
Catch ex As Exception
MsgBox(ex.ToString)
Finally
conn.Close()
End Try
End Sub