DataList 怎么显示从数据库读取并绑定的二进制数据?
从表中读取数据, 然后 绑定 到 DataList
其中有一个字段是 长二进制 数据类型,
怎么在 DataList 中显示吗?
下面的方法不行... 只显示: System.Byte[]
<div class= "text ">
<%# DataBinder.Eval(Container.DataItem, "content ") %>
</div>
详细:
<%@ Page Language= "C# " AutoEventWireup= "True " validateRequest= "false " %>
<%@ import Namespace= "System.Data " %>
<%@ import Namespace= "System.Data.OleDb " %>
<%@ import Namespace= "System.Web.UI.WebControls " %>
<%@ Assembly src= "cs/Pagination.cs " %>
<%@ Reference Control= "ac/sqEditor.ascx " %>
<%@ Reference Control= "ac/sqEditor.ascx " %>
<script runat= "server ">
public string EdRoot = "/sqEditor_DotNet/ ";
public string ReqIdStr = HttpContext.Current.Request.QueryString[ "id "];
public string ReqAidStr = HttpContext.Current.Request.QueryString[ "aid "];
void Page_Load(Object s, EventArgs e)
{
string SqlCnnStr;
SqlCnnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= "+
@MapPath(EdRoot+ "/data/shawlqiu.mdb ");
string SqlQuery;
SqlQuery = "select * from shawlqiu_ ";
switch(ReqIdStr)
{
case "edit ":
GetEditor( " <b> hello </b> , test this. ", edPlaceHolder, EdRoot+ "ac/sqEditor.ascx ");
break;
case "display ":
SqlQuery+= " where articleid = "+ReqAidStr;
DisplayList(SqlQuery, SqlCnnStr, acDisplayAtDataList);
break;
default:
DisplayList(SqlQuery, SqlCnnStr, acDataList);
break;
}
} // end Page_Load
private void DisplayList(string SqlQuery, string SqlCnnStr, DataList acDataList)
{
Pagination Paged=new Pagination();
Paged.Debug=false; // 是否为调试模式
Paged.DebugLabel=acDebugLabel; // 显示调试信息的 Label
Paged.NavigatorLabel=acPagedLabel; // 显示主导航条的 Label