Updating Table of Access Database
-
Hello all, I know it seems stupid, but i just cannot update a table of my access database. I get an error: In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user. The parameter (and then the value of my Agentnummer textbox) has no default value This is the code: daAgent.UpdateCommand.CommandText = ("UPDATE Agent " & _ "SET Agentnummer = " & txtAgentnummer.Text & ", " & "Agentnaam = " & txtAgentnaam.Text & _ " WHERE Agentnummer = " & agentNummerOud) daAgent.UpdateCommand.Connection.Open() daAgent.UpdateCommand.ExecuteNonQuery() daAgent.UpdateCommand.Connection.Close() Maybee this is not the right code at all for updating a table. Is there anyone who can help? Thanks!!!
-
Hello all, I know it seems stupid, but i just cannot update a table of my access database. I get an error: In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user. The parameter (and then the value of my Agentnummer textbox) has no default value This is the code: daAgent.UpdateCommand.CommandText = ("UPDATE Agent " & _ "SET Agentnummer = " & txtAgentnummer.Text & ", " & "Agentnaam = " & txtAgentnaam.Text & _ " WHERE Agentnummer = " & agentNummerOud) daAgent.UpdateCommand.Connection.Open() daAgent.UpdateCommand.ExecuteNonQuery() daAgent.UpdateCommand.Connection.Close() Maybee this is not the right code at all for updating a table. Is there anyone who can help? Thanks!!!
You're not putting quotes around the string. Your code is also open to SQL injection attacks. PErsonally, I don't get why anyone uses these update command things, I thnk they suck.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You're not putting quotes around the string. Your code is also open to SQL injection attacks. PErsonally, I don't get why anyone uses these update command things, I thnk they suck.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I would write a proper data layer, all my SQL in stored procs, and then call the methods as I needed them.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I would write a proper data layer, all my SQL in stored procs, and then call the methods as I needed them.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )