读取:
<asp:TemplateColumn HeaderText="Image">
        <ItemTemplate>
            <asp:Image 
            Width="150" Height="125" 
            ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "PersonID")) %>' 
            Runat=server />
        </ItemTemplate>
    </asp:TemplateColumn>
And the method FormatURL (A Server side Function) is as follows.     Function FormatURL(strArgument) as String
        Return ("readrealimage.aspx?id=" & strArgument)
    End Function And the method FormatURL (A Server side Function) is as follows.     Function FormatURL(strArgument) as String
        Return ("readrealimage.aspx?id=" & strArgument)
    End Function 
显示:
 Public Sub Page_Load(sender As Object, e As EventArgs)        Dim strImageID as String = Request.QueryString("id")        ' Create Instance of Connection and Command Object
        Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
        Dim myCommand As New SqlCommand("Select PersonImageType, PersonImage from das_person_real_images Where PersonID=" & strImageID, myConnection)        ' I have used the select statement. But it would be much much better, if you 
        'could write a small stored procedure which contains the above sql statement.
        ' Mark the Command as a SPROC (in case, if you wrote the stored procedure
        'myCommand.CommandType = CommandType.StoredProcedure        Try
            myConnection.Open()
            Dim myDataReader as SqlDataReader 
            myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
            Do While (myDataReader.Read())
                Response.ContentType = myDataReader.Item("PersonImageType")
                Response.BinaryWrite(myDataReader.Item("PersonImage"))
            Loop
            myConnection.Close()
        Catch SQLexc As SqlException        End Try    End Sub 

解决方案 »

  1.   

    假设你的Image参数:VbyteFile[](以二进制数组传入)这样判断:
    if (VbyteFile==null){
        //
    }
    else
    {
       //
    }
      

  2.   

    将数据库字段定义为image(可以存放:Doc,Txt,Gif,Jpg...所有文件)
      

  3.   

    http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=EY1XLDYV-PIDF-43LO-1WFL-FMY5ALE1F635
      

  4.   

    http://www.chinaaspx.com/searchsite.htm
      

  5.   

    哈哈,这个简单
    在查询分析器里  SELECT * FROM YourTable WHERE 图字段 IS NOT NULL楼上的不用这么兴师动众哈