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..
And your pdfhandler.ashx should read out the specific column from the existing db with the help of AccessDataBase,and then set——
Response.Clear();
Response.AddHeader(”Content-Disposition”,”attachment;filename=xxx.pdf”);
Response.ContextType="application/pdf";
Response.BinaryWrite(bytes of pdf read out from accessdb);
BoEneD
Member
39 Points
23 Posts
MS Access connected with asp.net; access on file attachements saved in accdb File
Jan 31, 2012 03:55 PM|LINK
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" DataSourceID="AccessDataSource1" EmptyDataText="Es sind keine Datensätze zum Anzeigen vorhanden." Width="918px"> <Columns> <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" /> </Columns> </asp:GridView> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="App_Data\Aufgaben.accdb" SelectCommand="SELECT [Titel], [Beschreibung], [Fälligkeitsdatum], [Anlagen], [ProgramName] FROM [Aufgaben] WHERE ([Öffentlich ALL] = ?)"> <SelectParameters> <asp:Parameter DefaultValue="true" Name="Öffentlich_ALL" Type="Boolean" /> </SelectParameters> </asp:AccessDataSource>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 ;)
greetings
Benedikt
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: MS Access connected with asp.net; access on file attachements saved in accdb File
Feb 02, 2012 01:01 AM|LINK
My suggestion is that you can:
1)Create or add a TemplateField into the GridView,Something like this:
<asp:TemplateField ……>
<ItemTemplate>
<a href='pdfhandler.ashx?id=<%#Eval("Id")%>'>PDF Download</a>
</ItemTemplate>
</asp:TemplateField>
And your pdfhandler.ashx should read out the specific column from the existing db with the help of AccessDataBase,and then set——