主题:查询问题
高手看一下这个问题:
每次提示frm_jiqiku.Adodc1.RecordSource = "select * from jiqiku where frm_jq." & listbox1.Text & " = + '%" & Text1.Text + "'+'%'"
这一句有问题。我觉得在frm_jq." & listbox1.Text & " = + '%" & Text1.Text + "'+'%'"上问题大。因为我不知道这些格式是怎么设置的?
Private Sub Command1_Click()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=SQLOLEDB.1;Password=h2f3n5j2;Persist Security Info=True;User ID=cn71197;Initial Catalog=cn71197_db;Data Source=121.198.155.231"
If Text1.Text = "" Then
MsgBox "请重新输入查询条件 !", vbExclamation, "提示信息"
Text1 = ""
Exit Sub
Else
frm_jiqiku.Adodc1.RecordSource = "select * from jiqiku where frm_jq." & listbox1.Text & " = + '%" & Text1.Text + "'+'%'"
Adodc1.Refresh
End If
End Sub
每次提示frm_jiqiku.Adodc1.RecordSource = "select * from jiqiku where frm_jq." & listbox1.Text & " = + '%" & Text1.Text + "'+'%'"
这一句有问题。我觉得在frm_jq." & listbox1.Text & " = + '%" & Text1.Text + "'+'%'"上问题大。因为我不知道这些格式是怎么设置的?
Private Sub Command1_Click()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=SQLOLEDB.1;Password=h2f3n5j2;Persist Security Info=True;User ID=cn71197;Initial Catalog=cn71197_db;Data Source=121.198.155.231"
If Text1.Text = "" Then
MsgBox "请重新输入查询条件 !", vbExclamation, "提示信息"
Text1 = ""
Exit Sub
Else
frm_jiqiku.Adodc1.RecordSource = "select * from jiqiku where frm_jq." & listbox1.Text & " = + '%" & Text1.Text + "'+'%'"
Adodc1.Refresh
End If
End Sub