I'd suggest making use of a standard try {} catch {} scoping and output (either to the form or as a MessageBox.Show()) the nature of the Exception that is caught.
I hope that this helps - it's proved useful on my learning curve to better understand why SQL statements are failing.
Steve
The try / catch and display of caught Exception should give some clues regardless of the database sitting underneath the application code.
Let us know how you get on.
Steve
try/catch... but code not go into the catch although ExecuteNonQuery() return 0.
I don't know why.
I change my update SQL query from:
m_strSQL = "UPDATE Car SET CarID = ?, Manufacture = ?,Color = ?, Hp = ?, Displacement = ?, Price = ?, Model = ?, SaleContractID = ? WHERE CarID = ? AND Manufacture = ? AND Color = ? AND Hp = ? AND Displacement = ? AND Price = ? AND Model = ? AND SaleContractID = ?";
to:
m_strSQL = "UPDATE Car SET CarID = ?, Manufacture = ?, Color = ?, Hp = ?, Displacement ?, Price = ?, Model = ?, SaleContractID = ? WHERE CarID = ? AND Manufacture = ? AND Color = ? AND Hp = ? AND Displacement = ? AND Price = "? AND Model = ?";
m_strSQL = "UPDATE Car SET CarID = ?, Manufacture = ?, Color = ?, Hp = ?, Displacement ?, Price = ?, Model = ?, SaleContractID = ? WHERE CarID = ? AND Manufacture = ? AND Color = ? AND Hp = ? AND Displacement = ? AND Price = ? AND Model = ?";
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.