MS Access connected with asp.net; access on file attachements saved in accdb File RRS feed

  • Question

  • User-623365515 posted

    Hey folks,

    here another question:

    i inserted the MS Access Database with drag and drop and modified the sql-code. Following Code:

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                EmptyDataText="Es sind keine Datensätze zum Anzeigen vorhanden." Width="918px">
                    <asp:BoundField DataField="Titel" HeaderText="Titel" SortExpression="Titel" />
                    <asp:BoundField DataField="Beschreibung" HeaderText="Beschreibung" 
                        SortExpression="Beschreibung" />
                    <asp:BoundField DataField="Fälligkeitsdatum" HeaderText="Fälligkeitsdatum" 
                        SortExpression="Fälligkeitsdatum" />
                    <asp:BoundField DataField="Anlagen" HeaderText="Anlagen" 
                        SortExpression="Anlagen" />">
                    <asp:BoundField DataField="ProgramName" HeaderText="ProgramName" 
                        SortExpression="ProgramName" />
            <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
                SelectCommand="SELECT [Titel], [Beschreibung], [Fälligkeitsdatum], [Anlagen], [ProgramName] FROM [Aufgaben] WHERE ([Öffentlich ALL] = ?)">
                    <asp:Parameter DefaultValue="true" Name="Öffentlich_ALL" Type="Boolean" />

    The field "Anlagen" is an attachement field in die *.accdb File, where I put in my pdf-Files...

    Question is now: Can i somehow manage to open the file by clicking on that name of the f.e. pdf-file on the webpage? Those files will just be pdf files... and of course should automatically be opened by the standard pdf program..

    Thx in advance ;)



    Tuesday, January 31, 2012 11:55 AM


  • User3866881 posted

    My suggestion is that  you can:

    1)Create or add a TemplateField into the GridView,Something like this:

    <asp:TemplateField ……>


             <a href='pdfhandler.ashx?id=<%#Eval("Id")%>'>PDF Download</a>



    And your pdfhandler.ashx should read out the specific column from the existing db with the help of AccessDataBase,and then set——

    Response.BinaryWrite(bytes of pdf read out from accessdb); 


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 1, 2012 9:01 PM