問個作業題
想在GridView中顯示資料庫中存盤的二進制圖片,代碼咋寫?(Image在資料庫中的列名叫做:Attachment)
.aspx中是這樣寫的
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="homework.aspx.vb" Inherits="homework" %>
...
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="ItemID">
<Columns>
<asp:CommandField ButtonType="Button" ShowSelectButton="True" />
<asp:BoundField DataField="ItemID" HeaderText="ItemID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
第一處:這里咋寫?
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
</Columns>
</asp:GridView>
在aspx.vb中的代碼:
...
主頁面顯示
Sub UpdateGridView()
...
If IsDBNull(drpIndustry.SelectedValue) Or drpIndustry.SelectedValue = "" Then
Else
mySQL1 = mySQL1 & " AND Industry= N'" & drpIndustry.SelectedValue & "'"
End If
mySQL1 = "SELECT * from tablename a " & _
"where a.ShowFlag = 1 " & _
" " & mySQL1 & " "
Me.SqlDataSource1.SelectCommand = mySQL1
第二處:咋寫?
con.Close()
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/195530.html
標籤:VB.NET
下一篇:html靜態網頁
