【问题标题】:how to insert images in sql server 2000 using classic asp.?如何使用经典 asp. 在 sql server 2000 中插入图像?
【发布时间】:2012-09-05 09:23:36
【问题描述】:

我刚刚遇到这个项目,我必须在网站的后端显示一些图像,因为我使用了 Classic Asp 和 SQL Server 2000,到目前为止,我可以显示数据库中的大部分内容。 我无法弄清楚这个图像的事情。我尝试了到目前为止我能理解的内容,我创建了一个表,其中有一个 img 列,其中包含图像数据类型,我不知道它是否正确。我应该如何绕过脚本来获取图像。

<table border="1" cellpadding="0" cellspacing="0" width="100%">
                <tr height="25px">
                    <th width="25%">Cover Name</th>
                    <th width="25%">Category Name</th>
                    <th width="17%">Thumbs</th>
                    <th width="17%">&nbsp;</th>
                    <th width="17%">&nbsp;</th>
                </tr>
                <%
                    sql = "SELECT * from covers"
                    rs.open sql, con, 1, 2
                    do while not rs.eof
                %>
                <tr>
                    <td align="center"><%=rs("c_name")%></td>
                    <td align="center"><%=rs("category")%></td>
                    <td align="center"><%=rs("img")%></td>
                    <td align="center"><a href="edit.asp?cover=<%=rs("c_name")%>">Edit</a></td>
                    <td align="center"><a href="delete.asp?cover=<%=rs("c_name")%>" onclick="var r =confirm('This Cover details will be deleted permenantly . Are you sure you want to DELETE');
                {
                    if (r==true)
                    alert('record will be deleted');
                    if (r==false)
                    return false;
                }">Delete Info</a></td>
                </tr>
                <%
                    rs.movenext
                    loop
                    rs.close
                %>
                </table>

【问题讨论】:

标签: asp-classic upload sql-server-2000


【解决方案1】:

将图像文件存储在磁盘上(可能是在 Web 服务器上)并仅将它们的文件名存储在数据库的“封面”表中会更好吗?

很抱歉没有直接回答您的问题,但是将二进制文件存储在数据库中的额外复杂性似乎并没有带来任何巨大的回报。

请参阅SO Post,了解更多关于该主题的更多信息。

【讨论】:

    猜你喜欢
    • 2017-12-02
    • 1970-01-01
    • 2011-12-05
    • 1970-01-01
    • 1970-01-01
    • 2021-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多