DetailsView linked to GridView on accessdatasource. DetailsView disappears when select used

Posted on 2008-11-17
Last Modified: 2013-11-07
I've seen lots of people mentioning this problem, but still I haven't been able to figure out how to fix it.

Basically 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.

So, I can get all that working fine, gridview is displayed, and detailsview is displayed and populated. But, when I go to use the 'Select' command on one of the rows of the GridView, instead of the DetailsView being populated with the new data, the DetailsView disappears altogether.

Now, this is probably because the DetailsView is not being populated at all. But, either way, I don't know how to fix it, I did not alter the project downloaded from '', but that's what happened. I've heard that it might have something to do with the DetailsView not being bound to the datasource on postback... but still, I'm not sure how to fix this.

Can anyone help?
Question by:AidenA
    LVL 16

    Accepted Solution

    They've supplied the wrong format for the FilterExpression, which is built using String Format placeholders rather than the Parameters used by the 'Commands.

    These placeholders are numbered, with 0 representing the first parameter in the FilterParameters collection, and so forth.  You specify the placeholder in the string by using set brackets around the index.  You further delimiting them by quotes if (and only if) the datatype is a string.

    It's confusing and annoying, is it not?


    Open in new window


    Author Comment

    Hi, it's a bit irritating alright when something that looks like it should be easy ends up taking ages to solve! I think it would have taken me forever to figure that one out.

    I'll accept that solution. But, I was just wondering if you might off hand have any idea about a related problem I have (I can open a new question if you do).

    Obviously I'm applying the techniques listed in that webpage to my own project. But something inexplicable is happening. The Update query does nothing. It seems to happen when I use the ? symbol as in the queries shown below. I need to use the ? symbol to make changes to the row that I'm editing (I presume you know already, but the ? symbol specifies that you use the data that is already there for that selection, so you can input data and then use that data to update to the table).

    But what's weirder, is that it works perfectly in the project I downloaded from ''. Everything looks fine... and I cannot see a difference between what they have done and what I have done. 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, today I open it up again... and it is not working again?

    Totally confused about that one also? Any ideas? (I will start a new question so let me know if you want me to do that)
    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

    LVL 16

    Expert Comment

    I'd need a bit more to go on.  The query itself looks perfectly fine, so the problem would lie either in the rest of the AccessDataSource, or the container that databinds with it.

    Author Comment

    Yeah, I have no idea what could be wrong with this. Don't have enough experience with web programming yet.

    I created a new question for it 'Simple Gridview Update query on accessdatasource not working' although this website did not allow me to attach a .aspx file to show the problem.

    If you can take a look or give me an idea about how to proceed that would be great.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now