| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2645 人关注过本帖
标题:急!求助 asp中使用ado写入读取access数据库中的ole对象类型字段
取消只看楼主 加入收藏
smkl
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2018-9-14
收藏
 问题点数:0 回复次数:0 
急!求助 asp中使用ado写入读取access数据库中的ole对象类型字段
需求  需要存储html
html 从word中复制表格出来到ueditor编辑器(此时ueditor编辑器将它变成了html)
发送 application/x-www-form-urlencoded格式用post方法发送
html的数据大于 备注 类型的64k
百度 无奈只好用Ole
不会 从asp中操作ole
百度  看到csdn的帖子
 参考(复制)帖子里的东西写出来没用

asp要做的是接受post发送过来的html并把它存到ole类型的字段中

程序代码:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%

 function TextToBinary(text)
  dim bindata,stream
  set stream=server.CreateObject("adodb.stream")
  with stream
    .Type=2'返回值text字符串模式
    .Mode=3'readwrite模式
    .Open'打开流
    .Charset="gb2312"'设置编码为gb2312
    .Position=0'设置流初始位置为0
    .WriteText text'写入字符串内容
    .Position=0'重新设置流位置为0,要不流位置处于最后,读不到数据
    .Type=1'设置流返回值类型为2进制
    bindata= .read'读取前面写入的字符串对应的2进制流数据
    .Close'关闭流
  end with
  TextToBinary=bindata
end function



Set conn = Server.CreateObject("ADODB.Connection")
connstr = "driver={Microsoft Access Driver (*.mdb)};pwd=admin;dbq=" & Server.MapPath("/") &"\\data\\TP000023.mdb"
conn.open connstr
set rec= server.createobject("ADODB.recordset")
strsql="select * from sd_model_photo where photoid = (select max(photoid) from sd_model_photo)"
rec.open strsql,conn,1,3
rec("xhsm").AppendChunk TextToBinary(request.form("xhsm"))
rec("xncs").AppendChunk TextToBinary(request.form("xncs"))
rec.update
rec.close
set rec = nothing
set conn = nothing
%>

搜索更多相关主题的帖子: asp ole 类型 html set 
2018-09-14 12:12
快速回复:急!求助 asp中使用ado写入读取access数据库中的ole对象类型字段
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019503 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved