日期:2014-05-17  浏览次数:20944 次

怎么把上传的图片存入SQL Server 2000数据库表image类型列里呢?
怎么把上传的图片存入SQL Server 2000数据库表image类型列里呢?
我贴上我的代码:【我2个文件:b1.asp文件和b2.asp文件。】
b1.asp文件代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<p>当前位置:上传照片</p>
<form action="b2.asp" method="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="if(this.filephoto.value==''){alert('请选择要上传的文件!');return flase;}">
  <table width="429" border="1" align="center" cellpadding="4" cellspacing="0" rules="none">
  <tr>
  <th width="417" scope="col">上传照片</th>
  </tr>
  <tr>
  <td height="60" align="center">选择图片所在的文件:
  <input type="file" name="filephoto" id="filephoto" /></td>
  </tr>
  <tr>
  <td align="center"><input type="submit" name="button" id="button" value="开始上传" /></td>
  </tr>
  </table>
</form>
</body>
</html>
b2.asp文件代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<%
dim ccc,ddd
ccc="select * from shangchuan"
set ddd=server.createobject("adodb.recordset")
ddd.open ccc,aaa,1,1
%>
<%
dim ppp
ppp=request.form("tupian1")
eee="set IDENTITY_INSERT shangchuan off insert into shangchuan(photo)values('"&ppp&"')"
aaa.execute(eee)
%>
//////////////////////////////////////////////////
【请前辈指引或代码或留下QQ】

------解决方案--------------------
代码
http://topic.csdn.net/t/20040625/13/3122429.html
http://topic.csdn.net/t/20021110/12/1163982.html
------解决方案--------------------
你的问题我没办法给你回答,但是我有个疑问,你为什么要把图片存到数据库中?为什么不直接把图片放在某个文件夹中,然后把地址存入数据库中。感觉把图片存入数据库中不是好的选择