(1)
I converted an ACCESS database to SQL Server 2000 database. There is a field for picture in a table. Its structure in ACCESS is 
NAME                    TYPE
image_id                Number
image_description       Text
image_picture           OLE Object
image_extension         Textand the structure in SQL Server (after converting) is 
NAME                    TYPE
image_id                int
image_description       nvarchar 
image_picture           image
image_extension         nvarcharThe problem is the below part codes (VB) don't work when the application is connected to SQL Server database. The "l_cmdTemp.Execute(}" will give the error "Err.Number: -2147217887,  Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done." (It works fine, if it is connected to ACCESS database.)
l_rstTemp.CursorLocation = adUseClient
l_rstTemp.CursorType = adOpenStatic
l_cmdTemp.CommandText = "select * from imagetab where image_id=?"
Set l_rstTemp = l_cmdTemp.Execute(, Array(p_lngImageID))(2)
Another problem is the "l_rstTemp.MoveFirst" in following codes will give the error "Rowset position cannot be restarted", if the application is connected to SQL Server database. (It works fine, if it is connected to ACCESS database.)
With l_cmdTemp
  .ActiveConnection = g_cnnRecon
  .CommandType = adCmdText
  .CommandText = "select comp_type_id, comp_type_name " & _
                 "from comp_type where " & _
                 "comp_type_grp_id = ? and " & _
                 "comp_type.comp_type_role_id <= ?"
End With
l_rstTemp.CursorLocation = adUseClient
l_rstTemp.CursorType = adOpenStatic
l_rstTemp.LockType = adLockReadOnly
Set l_rstTemp = l_cmdTemp.Execute(, _
                Array(m_lngCompTypeGroupId, g_udtUser.RoleId))
...
l_rstTemp.MoveFirst Any ideas for these problems?

解决方案 »

  1.   

    第二个问题:
    l_cmdTemp 返回的是一个只向前游标
    来不及了,明天再说吧
      

  2.   

    I have tried the all the combinations of l_rstTemp.CursorType and l_rstTemp.LockType, but get same error.
      

  3.   

    通过Command返回的Recordset总是adOpenForwardOnly,adLockReadOnly
    如果要返回一个静态的客户端的游标,请用Recordset的open 方法。另外,你第一个问题写得不够完整,是不是还没有打开connection
      

  4.   

    The connection part was not reviewed here, but it is opened before it. This part code works fine, if it is linked to same ACCESS database.