Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AccessDataSource UpdateQuery problem 1

Status
Not open for further replies.

NSNewey

Programmer
Jun 29, 2005
125
GB
Hi,

I have a gridview displaying data from an access database.

Everything works fine and I can edit data and the update works great.

The problem is that there are two fields in the gridview which I want the user to see but not to be able to edit.
So I changed the Update Query to only update the remaining fields.

Now the update does not work. There is no error on the debug page, it just doesn't update the changes.

This was the UpdateQuery when it was working...
UPDATE tBookedDates SET StartDate = ?, EndDate = ?, Booked = ?, PartialBooked = ?, Price = ? WHERE (BookedDateID = ?)

This is what I changed it to (doesn't work)
UPDATE tBookedDates SET Booked = ?, PartialBooked = ?, Price = ? WHERE (BookedDateID = ?)

I have only removed the StartDate and EndDate parts.

Any help would be appriciated.


 
Have you made sure that there are only the relevant fields in the query parameters? Sounds like the original 5 parameters are still present instead of the 3 you want.

If you have deleted the first two ?s from the query but not the parameters from the parameters list your query would equate to something like this:

(parameter fields marked like this [[red]parameters[/red]])

[tt]UPDATE tBookedDates SET Booked = [[red]StartDate[/red]], PartialBooked = [[red]EndDate[/red]], Price = [[red]Booked[/red]] WHERE (BookedDateID = [[red]PartialBooked[/red]])[/tt]

instead of

[tt]UPDATE tBookedDates SET Booked = [[red]Booked[/red]], PartialBooked = [[red]PartialBooked[/red]], Price = [[red]Price[/red]] WHERE (BookedDateID = [[red]BookedDateID[/red]])[/tt]

This would mean that unless you have a match for [tt]BookedDateID = [[red]PartialBooked[/red]][/tt] you will not get a relevant update
 
Thanks deltaflyer666

That was precicely the problem.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top