VB数据库代码编译错误..急啊..

来源:百度知道 编辑:UC知道 时间:2024/05/18 05:25:13
Private Sub Form_Load()
Dim conn As ADODB.Connection
Dim mrc As ADODB.Recordset
Dim txtsql As String
Dim i As Integer
Set conn = New ADODB.Connection
conn.Open cs
cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=考场排位.mdb"
Set mrc = New ADODB.Recordset
If Text1.Text = "" Then
If Text2.Text = "" Then
txtsql = "教室表"
Else
txtsql = "select * from 教室表 where 教室座位数='" + Text2.Text + "'"
End If
Else
If Text2.Text = "" Then
txtsql = "select * from 教室表 where 教室位置='" + Text1.Text + "'"
Else
txtsql = "select * from 教室表 where 教室位置='" + Text1.Text + "'and 教室座位数= '" + Text2.Text + "'"
End If
mrc.Open txtsql, conn, adOpenKeyset, adLockOptimistic
If mrc.EOF Then
MsgBox "没有查询到任何记录", , "提示"
With MSFlexGrid1
.Col

conn.Open cs
<br>cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=考场排位.mdb"
<br>
<br>两行对调。

End With
End If
End Sub
错误提示:块if没有end if 改为:
End With
End If
end if
End Sub