Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I test the UPDATE statement while running in debug mode I can update 2 joint tables multiple times and in the physical database I can see the changes that have been done.The problem starts when I close the project solution and reopen it and then try and update it throws up an
int32 UpdatedRowStatusErrors.I set breakpoints to check but it just throws up {Unspecified Error}

This is the code for the UPDATE event
C#
OleDbCommand update = new OleDbCommand("UPDATE Clockd SET ID =@ID,EmpNo =@EmpNo,[DateTime] =@DateTime," + "Calc0R1 =@Calc0R1,Calc2R1 =@Calc2R1,Calc3R1 =@Calc3R1,Calc4R1=@Calc4R1," +"TotalHours =@TotalHours,Target0R1=@Target0R1 WHERE ID =@ID",this.sourceConnection);
                                                   
                                                    
            update.Parameters.Add("@ID", OleDbType.Integer, 4, "ID");
            update.Parameters.Add("@EmpNo", OleDbType.VarChar, 51, "EmpNo");
            update.Parameters.Add("@DateTime", OleDbType.Date, 4, "DateTime");
            update.Parameters.Add("@Calc0R1", OleDbType.Double, 4, "Calc0R1");
            update.Parameters.Add("@Calc1R1", OleDbType.Double, 4, "Calc1R1");
            update.Parameters.Add("@Calc2R1", OleDbType.Double, 4, "Calc2R1");
            update.Parameters.Add("@Calc3R1", OleDbType.Double, 4, "Calc3R1");
            update.Parameters.Add("@Calc4R1", OleDbType.Double, 4, "Calc4R1");
            update.Parameters.Add("@TotalHours", OleDbType.Double, 4, "TotalHours");
            update.Parameters.Add("@Target0R1", OleDbType.Double, 4, "Target0R1");

            this.oAdapter.UpdateCommand = update;
            this.oAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
            this.oAdapter.Update(table);
            this.table.AcceptChanges();

            MessageBox.Show("Records Updated");


I searched around but but the answers are very vague and unclear.
Any help would be appreciated
thanks
Posted

At a guess, it's complaining about your ID value - normally you wouldn't need or want to update that as the value isn't going to actually change.
I'd start by trying it without setting the value of fields you aren't changing and see if that makes a difference.
 
Share this answer
 
Comments
Gerhard_Louis 19-Apr-15 10:30am    
Hi OriginalGriff.I did try without setting the values but once I close Visual Studio and reopen the test project I am unable to update the datagridview.It gives the same error
I solved the issue of the unknown exception by granting all permissions to folder where the database resides.Now I cant update the table without getting this error OleDbException (0x80004005): Unspecified error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900