- 爱易网页
-
ASP教程
- ASP+SQLSERVER2OOO有关问题
日期:2014-05-17 浏览次数:20906 次
ASP+SQLSERVER2OOO问题
<%
Response.Buffer=True
ImageSize=Request.TotalBytes '获取提交数据量的总字节数
ImageData=Request.BinaryRead(ImageSize) '保存从客户端读取到的数据
'优化读取到的二进制数据
BnCrLf=chrB(13)&chr(10)
Divider=LeftB(ImageData,Clng(InstrB(ImageData,BnCrLf))-1)
Dstart=InstrB(ImageData, BnCrLf& BnCrLf)+4
Dend=InstrB(Dstart+1, ImageData, Divider)- Dstart
MyData=MidB(ImageData, Dstart, Dend)
'创建对象实例
Set imgConn=Server.CreateObject( "ADODB.Connection ")
StrConn= "Driver={SQL Server};Server=localhost; "& _
"Uid=school;Pwd=school;DataBase=school "
imgConn.open strConn
Set Rs= Server.CreateObject( "ADODB.RecordSet ")
Sql= "Select * From img Where id is null "
Rs.open sql,imgConn,1,3
'追加数据到数据库
Rs.AddNew
Rs( "img ").AppendChunk myData
Rs.Update
'关闭和释放对象
Rs.close
ImgConn.close