图片的大小都在70K左右。以前都传得好好的。
最近开始经常出现超时的情况。
都是在Recordset的UPDATE操作上停住了。这是什么原因?或者有改良的方法吗?
    Dim Stream1 As New ADODB.Stream
    Stream1.Mode = adModeReadWrite
    Stream1.Type = adTypeBinary
    Stream1.Open
    Stream1.LoadFromFile PicPath
    Stream1.Position = 0    Dim Rs As New ADODB.Recordset
    With Rs
        CnPic.Execute "insert  pic select '" & PicHh & "',null where (select isnull(count(hh),0) from pic where hh='" & PicHh & "')=0"
        .Open "select * from pic where [hh]='" & PicHh & "'", CnPic, adOpenStatic, adLockOptimistic
    
        If .RecordCount = 0 Then
            .AddNew
            .Fields(0) = PicHh
        End If
        .Fields("pic").AppendChunk Stream1.Read
        .Update
        Rs.Close
    End With

解决方案 »

  1.   

    难道是SQL SERVER的问题?查过服务器系统空闲的时候,上传图片仍是会超时。
      

  2.   

    感觉没什么问题,不过CnPic.Execute "insert  pic select '" & PicHh & "',null where (select isnull(count(hh),0) from pic where hh='" & PicHh & "')=0"这句好象多余,因为你操作记录集时已经有ADDNEW(记录不存在时)了。
      

  3.   

    是多余的。之前怀疑是不是ADDNEW的问题。改为用Execute来插入试试看。也是不行的。