VB 语句 谁帮我解释一下

来源:百度知道 编辑:UC知道 时间:2024/09/23 23:27:15
Private Sub Form_Load()
Me.Icon = Mainfrm.Icon
DTPicker1.Value = Date
Dim rs1 As New ADODB.Recordset
Set rs1 = New ADODB.Recordset
Dim strsql As String
strsql = "select distinct 征定书号 from 图书征定表"
If rs1.State Then rs1.Close
rs1.Open strsql, CN, adOpenStatic, adLockOptimistic
While Not rs1.EOF
If Not IsNull(rs1.Fields(0)) Then
Combo1.AddItem Trim(rs1.Fields(0))
End If
rs1.MoveNext
Wend
End Sub

谁帮我检查一下中间的错误

你现在有什么错误啊?
自己先说明,不要考别人,因为代码还不完整的,别人不知道你的错误
最少If rs1.State Then rs1.Close 这句多余
还有CN没有打开