0

このプロジェクトに出くわしたところ、ClassicAspとSQLServer 2000を使用していたため、Webサイトのバックエンドにいくつかの画像を表示する必要がありました。これまでのところ、データベースからほとんどのものを表示できます。この画像のことはわかりません。これまで理解できたことを試してみましたが、画像データ型の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>
4

1 に答える 1

0

画像ファイルをディスク(おそらくWebサーバー)に保存し、それらのファイル名のみをデータベースの「cover」テーブルに保存する方がよいでしょうか。

あなたの質問に直接答えていないことをお詫びしますが、データベースにバイナリファイルを保存するという余分な複雑さは、見返りに大きな利点を提供していないようです。

この件に関する詳細については、このSO投稿を参照しください。

于 2012-09-12T14:59:08.270 に答える