存在语法错误,请各位老师改正
rs.Open "select * from " & ListView1.SelectedItem.Text & "where" & ListView1.SelectedItem.Text & "=" & TreeView1.SelectedItem.Text, cn where前后要有空格,cn后面还有2个参数 rs.Open "select * from " & ListView1.SelectedItem.Text & " where " & ListView1.SelectedItem.Text & " = '" & TreeView1.SelectedItem.Text & "'", cn,3,3
dim sCmd as string
sCmd="select * from " & ListView1.SelectedItem.Text & " where " & ListView1.SelectedItem.Text & "= " & TreeView1.SelectedItem.Text&""
debug.print sCmd
然后把SQL语句拿去数据库中执行. ListView1.SelectedItem.Text不可能既是表名又是字段名
补充:VB , 基础类