求大神解:vb中的ado控件如何用sql语句查找开头含有已知字符串(该字符串存入到一个公共变量)的字段,并用datagrid控件显示该ado查找到的数据。
SELECT *
FROM StudentInfo
WHERE StudentClassID Like '%str1%' AND StudentDepart="str2";
这是我打的,不知为什么实现不了
SELECT *
FROM StudentInfo
WHERE StudentClassID Like '%str1%' AND StudentDepart="str2";
这是我打的,不知为什么实现不了
FROM StudentInfo
WHERE StudentClassID Like '%"& str1 &"%' AND StudentDepart='"& str2 &"'
SELECT *
FROM StudentInfo
WHERE StudentClassID Like '%"& str1 +"&' AND StudentDepart='"& str2 &"';
FROM StudentInfo
WHERE StudentClassID Like '%"& str1 &"%' AND StudentDepart='"& str2 &"'
这回没错,还是不行,麻烦你了,谢谢你帮忙
Private Sub Command1_Click()
str1 = ...
str2 = ...
Adodc1.RecordSource = "SELECT * " & _
"FROM StudentInfo " & _
"WHERE StudentClassID Like '%" & str1 & "%' " & _
"AND StudentDepart='" & str2 & "'"
Adodc1.Refresh
End Sub
Private Sub Command1_Click()
str1 = ...
str2 = ...
Adodc1.RecordSource = "SELECT * " & _
"FROM StudentInfo " & _
"WHERE StudentClassID Like '%" & str1 & "%' " & _
"AND StudentDepart='" & str2 & "'"
Adodc1.Refresh
End Sub