vb ado控件查询问题
Adodc2.RecordSource = "select * from 毕业证信息表 where 姓名 in('" & List1.List(List1.ListIndex) & "')"
这句代码怎么错了啊 我想实现查询名字在listbox内的所有人员信息
VB code:
Dim i As Integer
Dim strNames As String
strNames = ""
For i = 1 To List1.ListCount
strNames = ",'" & List1.Text & "'"
Next i
strNames = Right(strNames, Len(strNames) - 1)
If Len(strNames) = 0 Then
Exit Sub
End If
Adodc2.RecordSource = "select * from 毕业证信息表 where 姓名 in(" & strNames & ")"
in()括号内的各元素要用逗号隔开
VB code:
Private Sub Command1_Click()
Dim i As Long, strTmp As String
For i = 0 To List1.ListCount-1
strTmp = IIf(strTmp = "", "'" & List1.List(i) & "'", strTmp & ",'" & List1.List(i) & "'")
Next i
Adodc2.RecordSource = "select * from 毕业证信息表 where 姓名 in(" & strTmp & ")"
End Sub
相关问答:
为什么C写的DLL文件C、PB能调用VB不能调用?
VB里为什么有的DLL直接通过引用可以使用?有的需要通过declare申明外部函数?这些DLL有什么差别?
1、为什么PB能通过DECLARE声明而VB不行?
2、如果这个dll中的 ......
我有厂家做的ASP的监控录像(DVR)的局域网播放的源程序与控件,想要用ASP.net做一个视频回放的程序(利用他的控件)但不知如下去做,望各位指点。
先搞清楚他们的控件是怎么用的,
然后就直接用好了.
不过,如 ......
请教一下:我用vb写了一个调用Illustrator的测试程序,代码很简单:Private Sub Command1_Click()
Dim app As New Illustrator.Application
Dim doc As Illustrator.Document
Dim thislayer As Illustrator.Layer ......
VB偶学得不错,现在大一,高三的时候就学VB了,现在学校里都是学C#和VB.NET的兄弟多。。。
偶要转行VB.NET了~当年学VB学了2年,对VB里面的常用函数都十分了解。
Select、If结构、For Next循环、等都了解。。。 ......