what happens is i have a weekly salary table and once a week an administrator computes the salaries and it will be saved there, i want the delete code to delete the already saved record with the same Emp_ID as what i'm trying to save. my problem is i don't think the code i put deletes the record because it will still tell me that there is already an Emp_ID the same with what i'm trying to save..
so far this is my code..
Dim cnn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source = C:\Users\Florie\Documents\Visual Studio 2008\Projects\Payroll System\Payroll System\obj\x86\Debug\Payroll_MaryRoseAn.accdb") Dim cmd As New OleDbCommand cmd.Connection = cnn cmd.CommandType = CommandType.Text cmd.CommandText = "DELETE * FROM Salary Where [Emp_ID]=" & Trim(Emp_IDTextBox.Text) & "" Using cnn cnn.Open() cmd.ExecuteNonQuery() End Using
This post has been edited by sanoshiy: 01 October 2011 - 08:21 PM