VB.NET没有显示图片?

时间:2015-12-27 20:26:59

标签: sql asp.net asp.net-mvc vb.net

我不知道发生了什么,但图片没有显示,只有我得到的东西只是一个带边框的空白。

我得到的头像取决于数据库上的用户名:

Private Function grab_p_pic(ByVal username As String) As Boolean
    Try
        Using saConn As New SqlConnection(fyben_reader)
            Dim query As String = "SELECT profile_pic_url FROM fybens_lair_website.dbo.db_web_profile WHERE username = '" & SafeSqlLiteral(username) & "'"
            Dim cmd As New SqlCommand(query, saConn)

            saConn.Open()

            Using saReader As SqlDataReader = cmd.ExecuteReader
                While saReader.Read
                    profile_pic_url.ImageUrl = saReader("profile_pic_url")
                End While
            End Using
            saConn.Close()
        End Using
    Catch ex As Exception
        submitError(ex.Message)
    End Try
End Function

设计:

<div class='right_content' style='text-align: center;'>
                            <div id="profile_pic" runat="server">
                                <asp:Image ID="profile_pic_url" runat="server" Height="120" Width="120" />
                            </div>
                        </div>

0 个答案:

没有答案