我的毕业设计,集合中的关键字不唯一的问题,请高手帮忙解决
Private Sub Form_Activate()
Dim i As Integer
Dim rds_booksort As ADODB.Recordset
Set rds_booksort = New ADODB.Recordset
Call renew
myconn.Execute "drop table BOOK_SORT "
rds_booksort.Open "SELECT DISTINCT BOOK_SORT INTO BOOK_SORT FROM 图书信息 ", myconn, adOpenKeyset, adLockOptimistic, 1
rds_booksort.Open "SELECT BOOK_SORT FROM BOOK_SORT ", myconn, adOpenKeyset, adLockOptimistic, 1
TreeView1.Nodes.Add , , "R ", "所有 "
For i = 0 To rds_booksort.RecordCount - 1
TreeView1.Nodes.Add "R ", tvwChild, "s " & i, rds_booksort.Fields(0)
rds_booksort.MoveNext
Next i
TreeView1.Nodes( "R ").Expanded = True
rds_booksort.Close
Call Cmd_Book_clear_Click
Call MSHGridset
MDIMain.StatusBar1.Panels(3) = "共有图书 " & MSHFlexGrid1.Rows - 1 & "本满足条件 "
当我用VB第一次运行这个窗体的时候没有错误,为什么第二次加载会有错误提示集合中的关键字不唯一,一直不明白这是为什么,请各位高手赐教,不胜感激。
[解决办法]
TreeView1.Nodes( "R ").Expanded = True
rds_booksort=null
rds_booksort.Close