各位大虾帮忙啊!(在线等待)

chinareny 2002-05-15 03:58:46
我将本地的一个文件写到sql server中,方法如下。现在的问题是:我上传超过5M的文件时就报告超时错误。WHY??代码如下!另外,我如果用CONNECTIONG,并且设置了TIMEOUT足够大,但还是超时!

Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset

strSql = "select max(id) as maxid from t_bookinfo"
Rs.Open strSql, strCn
bookid = Rs("maxid")
Rs.Close
strSql = "select * from t_bookinfo where id='" & bookid & "'"
Rs.Open strSql, strCn, 1, 3

Dim Buffer() As Byte
Dim flen
flen = FileLen(txtBookPath.Text)
Open txtBookPath.Text For Binary As #1
ReDim Buffer(flen - 1)
Get #1, , Buffer
Rs.Fields("content").AppendChunk (Buffer)
Rs.Update
Rs.Close
Set Rs = Nothing

...全文
30 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
shawls 2002-05-15
  • 打赏
  • 举报
回复

我来up!
golden24kcn 2002-05-15
  • 打赏
  • 举报
回复
你能不能用别的方法,这个我试过,是没有这个问题的,(我上传过5M多的大图片)

Private Sub SaveToDB(RY As String)
Dim Rst As New ADODB.Recordset
Dim Mstream As New ADODB.Stream
Dim SQL As String
Dim MediaName As String

MediaName = Trim$(PicFileName)


Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
SQL = "select * from ry_manage where rybh='" & RY & "'"
Rst.Open SQL, Conn, adOpenStatic, adLockPessimistic, adCmdText

Set Mstream = New ADODB.Stream
Mstream.Type = adTypeBinary
Mstream.Open

Mstream.LoadFromFile PicFileName
Rst.Fields("Pic").Value = Mstream.Read
Rst.Update

Rst.Close
Set Rst = Nothing
Set Mstream = Nothing
end sub
chinareny 2002-05-15
  • 打赏
  • 举报
回复
自己up一下!
chinareny 2002-05-15
  • 打赏
  • 举报
回复
content是我的字段名!!!
zdk 2002-05-15
  • 打赏
  • 举报
回复
content 是什么类型?
chinareny 2002-05-15
  • 打赏
  • 举报
回复
我想这个地方应该和timeout没有关系了吧!因为我曾经讲起设为210000000,我想如果真的是这儿的问题的话,当我看到超时的报告时,我已经饿死了!呵呵
junwhj 2002-05-15
  • 打赏
  • 举报
回复
把TIMEOUT值设为0再试试
chinareny 2002-05-15
  • 打赏
  • 举报
回复
没有人捧场,只好我自己up啦!
斑竹在不在啊?
chinareny 2002-05-15
  • 打赏
  • 举报
回复
怎么没有人在啊!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧