data update error in c# sql
I want to change the password of the user in the database. I get the password changed warning on the code side, but there is no update in the database.


5 Replies
you aren't checking if the query actually modified anything
without seeing your database i can only assume your query is incorrect
👀
i'm choosing to ignore the plaintext password because it's probably a school assignment
For starters, stick to C# naming conventions or better naming conventions at all.
Name C# methods & objects Pascal-Case, be consistent in your SQL queries uppercasing keywords like
SELECT not Select or mixing both throughout your codebase.
Besides this, use the universal science language for all in-code names, English.
We can only assume what things like beglanti might be.
Use Gates before executing parametrized queries, e.g. the Text property of your textbox might be null or empty, which will result in an exception.
Never use or store plain-text passwords, use appropriate hashes.
Encapsulate UI functions from the business-logic.
ExecuteNonQuery is a function, it returns the affected rows in int, use this to verify the query.Thanks for your comments. The program was giving an error because I used 2 'FrmSifreYenileme' objects. I deleted one and it was fixed.