C
Carlo Razzeto
I'm sorry, I was posting this before and ctrl + entered too soon:
Hello, I am under taking my first project that will use MS Access as it's
back end data store. The project was originally written against SQL Server
and worked happily but the client suddenly wanted to switch to Access (don't
ask me why because I don't know). Anyway, here is my problem... I am writing
an object that I will use as my authentication token on my web page. The way
it works is when you instantiated it, it connects to the database, queries
the tables for the data it needs, then closes its database connection and
cleans up after its self. That part of the project ported just fine and
works great, the problem I'm having is with a method of my user object that
updates user information. Even though my update query appears to be correct,
it's throwing a OleDbException loaded with the error "Syntax error in UPDATE
statement.". Here is the query that is being sent to the datase:
UPDATE users SET first_name = 'Carlo', last_name = 'Razzeto', password =
'gateway1', email_address = '(e-mail address removed)', access_level
='ADMINISTRATOR' WHERE user_idnum = 1
Here is how I am currently generating the query, however when I first
started having the problem I was declaring variables in the query and using
OleDbCommand.Paramaters.Add to load in the data:
this.Command.CommandText = "UPDATE users SET first_name = '" + first + "',
last_name = '" + last + "', password = '" + pass + "', email_address = '" +
email + "', access_level = '" + access + "' WHERE user_idnum = " +
this.user_idnum;
this.Command.ExecuteNonQuery();
General over view of how object works:
Instantiate object
Instatiation method calls initialize method that collects all object data
from the DB then disconnects
update method updates database then calls initialize method
Carlo Razzeto
(e-mail address removed)
Hello, I am under taking my first project that will use MS Access as it's
back end data store. The project was originally written against SQL Server
and worked happily but the client suddenly wanted to switch to Access (don't
ask me why because I don't know). Anyway, here is my problem... I am writing
an object that I will use as my authentication token on my web page. The way
it works is when you instantiated it, it connects to the database, queries
the tables for the data it needs, then closes its database connection and
cleans up after its self. That part of the project ported just fine and
works great, the problem I'm having is with a method of my user object that
updates user information. Even though my update query appears to be correct,
it's throwing a OleDbException loaded with the error "Syntax error in UPDATE
statement.". Here is the query that is being sent to the datase:
UPDATE users SET first_name = 'Carlo', last_name = 'Razzeto', password =
'gateway1', email_address = '(e-mail address removed)', access_level
='ADMINISTRATOR' WHERE user_idnum = 1
Here is how I am currently generating the query, however when I first
started having the problem I was declaring variables in the query and using
OleDbCommand.Paramaters.Add to load in the data:
this.Command.CommandText = "UPDATE users SET first_name = '" + first + "',
last_name = '" + last + "', password = '" + pass + "', email_address = '" +
email + "', access_level = '" + access + "' WHERE user_idnum = " +
this.user_idnum;
this.Command.ExecuteNonQuery();
General over view of how object works:
Instantiate object
Instatiation method calls initialize method that collects all object data
from the DB then disconnects
update method updates database then calls initialize method
Carlo Razzeto
(e-mail address removed)