再求助,刷财富回来了! 根据条件查询access,并将结果显示到listview中,求详细代码
根据txtbox输入的内容“txtSendFrom”,点击按钮查询MailInfo表中TelNum字段符合的显示到listview中,显示内容“MailAddress、s...
根据txtbox输入的内容“txtSendFrom”,点击按钮查询MailInfo表中TelNum字段
符合的显示到listview中,显示内容“MailAddress、subject、mailDateTime”
希望有详细代码!可以追加财富! 展开
符合的显示到listview中,显示内容“MailAddress、subject、mailDateTime”
希望有详细代码!可以追加财富! 展开
展开全部
手头没有具体的数据库,所中友谈以打开卖碰数据库的部分已省略,查询和显示的代码如下:
form1上有listview控件,名称listview1,文本框控件,名称txtSendFrom,按钮控件,名称command1
Private Sub Command1_Click()
Set rsget = ExecuteSQL("select * from MailInfo where TelNum='" & txtSendFrom.Text & "'")
With Me.ListView1
.View = lvwReport
.ColumnHeaders.Add , , "MailAddress"
.ColumnHeaders.Add , , "subject"
.ColumnHeaders.Add , , "mailDateTime"
Do While rsget.EOF = False
.ListItems.Add , , rsget("MailAddress")
.ListItems(1).SubItems(1) = rsget("告漏subject")
.ListItems(1).SubItems(2) = rsget("mailDateTime")
rsget.MoveNext
Loop
End With
End Sub
form1上有listview控件,名称listview1,文本框控件,名称txtSendFrom,按钮控件,名称command1
Private Sub Command1_Click()
Set rsget = ExecuteSQL("select * from MailInfo where TelNum='" & txtSendFrom.Text & "'")
With Me.ListView1
.View = lvwReport
.ColumnHeaders.Add , , "MailAddress"
.ColumnHeaders.Add , , "subject"
.ColumnHeaders.Add , , "mailDateTime"
Do While rsget.EOF = False
.ListItems.Add , , rsget("MailAddress")
.ListItems(1).SubItems(1) = rsget("告漏subject")
.ListItems(1).SubItems(2) = rsget("mailDateTime")
rsget.MoveNext
Loop
End With
End Sub
追问
还是有问题啊,要不加个Q,解决了,加到100财富吧!
Dim addLvw As ListItem
Dim rsGet As New ADODB.Recordset
Set rsGet = ExecuteSQL("select * from MailInfo where TelNum='" & txtSearch, strMsg)
With rsGet
Do While rsGet.EOF = False
addLvw.SubItems(1) = .Fields("MailAddress").Value
addLvw.SubItems(2) = .Fields("subject").Valuers
……
Get.MoveNext
Loop
End With
Set rsGet = Nothing
追答
好,QQ:1941086,财富并不重要,能帮助别人就能得到成就感,呵呵,加好友时注明百度ID
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询