rs的问题,在线等!!

antelope0606 2003-08-21 10:42:54
select distinct kindname from t_jw_material_yq where kindname is not null
select kindname from t_jw_material_yq where kindname is not null

以上两条sql语句,用rs.open(sql,conn,,)打开
第一条返回recordcount为-1,
第二条为正确的记录集
请明白人指点
...全文
23 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangchong 2003-08-22
  • 打赏
  • 举报
回复
我也曾这样引用,但我觉得你的SQL语句是不是该这样写:
select distinct,kindname from t_jw_material_yq where kindname is not null
试试看!
canic 2003-08-22
  • 打赏
  • 举报
回复
呵呵,在VB.net里面调用ADO,似乎有一点大材小用,但还是满过瘾。
recordcount返回值-1,多为游标问题。
试试
With rs
.CursorLocation = adUseClient
.CursorType = ADODB.CursorTypeEnum.adOpenStatic
.LockType = ADODB.LockTypeEnum.adLockOptimistic
End With
这样应该可以了。
记得要
Imports ADODB.ConnectionClass
Imports ADODB.RecordsetClass
Imports ADODB.CursorLocationEnum
Imports System.DBNull
不然找不到命名空间。
xmxjh 2003-08-22
  • 打赏
  • 举报
回复
是不是记录都是重复的,并且SQL不支持此种游标类型。所以返回为-1,要不是会返回0的……
minajo21 2003-08-21
  • 打赏
  • 举报
回复
rs vb6?

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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