Simple Gridview Update query on accessdatasource not working

I am trying to implement the scenario mentioned in ''. They say that you can't addrows using the gridview on an access database, and so you have to use the detailsview in association with the gridview as they mention in their article.

I can get everything to work, except for the update query. Forgetting about the detailsview, I still can't get the update query on the gridview to work. I can get for instance, the first query below to work, but the second query which uses a ? symbol in both cases doesn't update anything. Just doesn't work. However, the strange thing is that I downloaded and implemented the project defined in '' and it works perfectly. The query is exactly the same format and works fine. So, I can't for the life of me figure out what is wrong?

In fact, I basically used their objects and transferred the data from my table into theirs, deleting all their data of course and changing the queries to suit me... and it worked perfectly, the second query below worked fine! But, then I added the details view to it and it randomly stopped working again? Looks like this website won't allow me to attach the aspx page to show the problem. How to solve?

Any help would be greatly appreciated.

This works:
UPDATE [User Information] SET [User Name] = ? WHERE (ID ='1234')
This does not work:
UPDATE [User Information] SET [User Name] = ? WHERE (ID = ?)

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you added ID to the DataKeyNames of the Gridview?
AidenAAuthor Commented:
Yep it is there as in the picture.
AidenAAuthor Commented:
Here's the query as well
Have you set the fields that aren't updated to read only?

Also in your accessdatasource change the conflictdetection property. At the moment it's at compareallvalues, I'm not sure exactly what the setting will be but you want to turn this off.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AidenAAuthor Commented:
Yes, you're right... thank god! I never would have figured that out. Both those things mean that nothing happens when you try to edit.

It was just bad luck I put on the 'compareallvalues' selection because I read in another post to do that and it didn't make any difference because the query i ran it on had all properties set to readonly = false. My main query would have worked then actually since nothing is read only, all columns are used. But then when I tried the smaller query in the beginning and it was on overwritechanges it didn't work then either because i needed to set the other fields to read only! Round and round...

Well, thanks for that anyway I was getting a bit worried!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.