Forum Moderators: open

Message Too Old, No Replies

ASP edit page not updating db

         

galahad2

12:35 pm on Oct 2, 2009 (gmt 0)

10+ Year Member



Hi, I've had to undertake a project to fix some administrative problems with a site built using ASP pages and connecting to a mySQL db. I haven't really used ASP much before and I'm trying to work out what's causing these issues.

The page below basically is an editing page for a record pulled from the mySQL db. Each of the fields should be editable, you make the edits you need and click the Submit to enter them into the table in the db.

The problem is, the details just refuse to update. There's no connection error of any kind, the edit just doesn't seem to work at all. I see a brief "0 rows were affected" message page before it goes back to exactly the same screen as before.

The db itself seems to be working ok as items from it are being pulled in and displayed.

Unfortunately the page code is too long for this forum and I've no idea which parts of it are causing the problem, but if someone(s) can give me some ideas as to what to start looking for (bearing in mind I really don't know my round ASP much so in layman's terms if possible) that would be much appreciated.

Ocean10000

1:49 pm on Oct 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can you paste the sql statement being used to update the database. It sounds like everything else is working but the update itself. I am guessing it is a problem in the sql statement.

galahad2

2:00 pm on Oct 2, 2009 (gmt 0)

10+ Year Member



This is the SQL update statement:

MM_editCmd.CommandText = "UPDATE allaston.cars SET is_live = ?, first_set_live_on = ?, is_archived = ?, archived_on = ?, Sold = ?, Order_no = ?, title = ?, Price = ?, Variant = ?, Chassis_no = ?, Make = ?, Engine_no = ?, Model_type = ?, Full_registration = ?, First_registration = ?, Year_of_car = ?, Colour = ?, Doors = ?, Interior = ?, Four_wheel_drive = ?, Hood = ?, Mileage = ?, Mileage_warranty = ?, Engine_size = ?, Steering = ?, Fuel_type = ?, Comments = ?, Options = ?, car_description = ?, MOT_history = ?, Service_history_details = ?, sold_on = ? WHERE ID = ?"

Thinking about it I could post the head and bodyt parts of the page separately in two posts which I think would be under the character limit, if that would help.

Ocean10000

3:40 pm on Oct 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sql looks ok. Nice use of parematerized SQL statment. You might want to check what ID is being supplied to the Query. I am thinking its being feed an id that (1) doesn't exist, (2)doesn't belong to the record being updated, (3) or possibly blank.

You may wish to just show the code that handles the update and retrieving the form values to feed into the sql. Not the rest of the code which generates the actual html.