updating database using parameters

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi:
I have an access db that I'm accessing via ASP.Net. I'm using WebMatrix's
wizard to write the tedious db query code using parameters.
Select, insert, and delete work fine using the database parameters. I
can't seem to get the update code to work. If I write my own code using a
standard SQL statement like: "UPDATE db SET field='somevalue' WHERE
id=someinteger" : the update works properly. But with webmatrix's code, the
update doesn't occur. No error messages either, even with the try catch
blocks commented out.

I really need to use parameters here as the text boxes need to accept all
ascii characters, and I know what a single quote does to a SQL String.
If I cant get this problem solved, I'n going to have to set the update page
to first insert a new record then delete the old one. But I think that would
be the hard way .

CAn anyone make a suggestion?

Thanks,
Mark
 
Hi:
I have an access db that I'm accessing via ASP.Net. I'm using WebMatrix's
wizard to write the tedious db query code using parameters.
Select, insert, and delete work fine using the database parameters. I
can't seem to get the update code to work. If I write my own code using a
standard SQL statement like: "UPDATE db SET field='somevalue' WHERE
id=someinteger" : the update works properly. But with webmatrix's code, the
update doesn't occur. No error messages either, even with the try catch
blocks commented out.

I really need to use parameters here as the text boxes need to accept all
ascii characters, and I know what a single quote does to a SQL String.
If I cant get this problem solved, I'n going to have to set the update page
to first insert a new record then delete the old one. But I think that would
be the hard way .

Just before executing the SQL, have it print to the screen that actual
SQL statement generated. Most likely, if there are no errors, the
"someinteger" value is being set to a nonsense value like 0, or the
"somevalue" item is being set to the old value (less likely). If you
spit out the SQL code, you can see what is being asked.
 
Back
Top