VB 点击list1里的内容在MSHFlexGrid1内显示出来
'打开程序首先数据库连接Str=App.PathIfRight(Str,1)<>"\"ThenStr=Str&"\data"ElseStr=Str&"data"EndIf...
'打开程序首先数据库连接
Str = App.Path
If Right(Str, 1) <> "\" Then
Str = Str & "\data"
Else
Str = Str & "data"
End If
Str = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Str & "\shujuku.mdb" & ";Jet OLEDB:Database password=123"
'MSHFlexGrid1其次读取数据库内容
Db.Open Str
Set Rs = New ADODB.Recordset
Rs.CursorLocation = adUseClient
Rs.Open "SELECT * FROM LcPassWord", Db, adOpenDynamic, adLockOptimistic
If Rs.RecordCount > 0 Then
List1.Clear
Rs.MoveFirst
Do While Not Rs.EOF
List1.AddItem Rs.Fields("text1")
Rs.MoveNext
Loop
Rs.MoveFirst
' Set MSH.Recordset = Rs
End If
'list1里点击的内容
If Rs.RecordCount > 0 Then
Set MSHFlexGrid1.Recordset = Rs
End If
现在是,list1读取数据库text1列的内容,如果有多个相同也只是显示一行,当点击list内的一行比如"123"则MSHFlexGrid1内显示除数据库text1列内所有拥有123值
请高手帮忙!先给20,后续再加80分!求等啊,先在此谢谢了
If Rs.RecordCount > 0 Then
List1.Clear
Rs.MoveFirst
Do While Not Rs.EOF
List1.AddItem Rs.Fields("text1") '估计是在这里加个重复判断
Rs.MoveNext
Loop
Rs.MoveFirst
' Set MSH.Recordset = Rs
End If
If Rs.RecordCount > 0 Then
Set MSHFlexGrid1.Recordset = Rs '估计是在这里也要加个判断
End If 展开
Str = App.Path
If Right(Str, 1) <> "\" Then
Str = Str & "\data"
Else
Str = Str & "data"
End If
Str = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Str & "\shujuku.mdb" & ";Jet OLEDB:Database password=123"
'MSHFlexGrid1其次读取数据库内容
Db.Open Str
Set Rs = New ADODB.Recordset
Rs.CursorLocation = adUseClient
Rs.Open "SELECT * FROM LcPassWord", Db, adOpenDynamic, adLockOptimistic
If Rs.RecordCount > 0 Then
List1.Clear
Rs.MoveFirst
Do While Not Rs.EOF
List1.AddItem Rs.Fields("text1")
Rs.MoveNext
Loop
Rs.MoveFirst
' Set MSH.Recordset = Rs
End If
'list1里点击的内容
If Rs.RecordCount > 0 Then
Set MSHFlexGrid1.Recordset = Rs
End If
现在是,list1读取数据库text1列的内容,如果有多个相同也只是显示一行,当点击list内的一行比如"123"则MSHFlexGrid1内显示除数据库text1列内所有拥有123值
请高手帮忙!先给20,后续再加80分!求等啊,先在此谢谢了
If Rs.RecordCount > 0 Then
List1.Clear
Rs.MoveFirst
Do While Not Rs.EOF
List1.AddItem Rs.Fields("text1") '估计是在这里加个重复判断
Rs.MoveNext
Loop
Rs.MoveFirst
' Set MSH.Recordset = Rs
End If
If Rs.RecordCount > 0 Then
Set MSHFlexGrid1.Recordset = Rs '估计是在这里也要加个判断
End If 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询