<Script Language="VB" Runat="Server">
Sub BindList(PageNo As Integer)
Dim sorttwo As string
sorttwo = Request.QueryString("sorttwo")
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("do#done.mdb")
if Request.QueryString("sorttwo") ="" then
Dim strSQL As String = "Select * From table_pro where pro_vip = '"&cstr(0)&"' order by pro_id desc"
else
Dim strSQL As String = "Select * From table_pro where pro_sort_two ='"& sorttwo &"' and pro_vip = '"&cstr(0)&"' order by pro_id desc"
end ifBy pro_id Desc" Dim objCmd As New OleDbDataAdapter(strSQL, ConnString)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
编译器错误信息: BC30451: 名称“strSQL”未声明。(上面最后一行)=================================================================
当我把:
if Request.QueryString("sorttwo") ="" then
Dim strSQL As String = "Select * From table_pro where pro_vip = '"&cstr(0)&"' order by pro_id desc"
else
Dim strSQL As String = "Select * From table_pro where pro_sort_two ='"& sorttwo &"' and pro_vip = '"&cstr(0)&"' order by pro_id desc"
end if
'************************
改成只要其中一句,如:
Dim strSQL As String = "Select * From table_pro where pro_vip = '"&cstr(0)&"' order by pro_id desc"
又不会出错,这是什么原因?
要怎么修改呢?
Sub BindList(PageNo As Integer)
Dim sorttwo As string
sorttwo = Request.QueryString("sorttwo")
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("do#done.mdb")
if Request.QueryString("sorttwo") ="" then
Dim strSQL As String = "Select * From table_pro where pro_vip = '"&cstr(0)&"' order by pro_id desc"
else
Dim strSQL As String = "Select * From table_pro where pro_sort_two ='"& sorttwo &"' and pro_vip = '"&cstr(0)&"' order by pro_id desc"
end ifBy pro_id Desc" Dim objCmd As New OleDbDataAdapter(strSQL, ConnString)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
编译器错误信息: BC30451: 名称“strSQL”未声明。(上面最后一行)=================================================================
当我把:
if Request.QueryString("sorttwo") ="" then
Dim strSQL As String = "Select * From table_pro where pro_vip = '"&cstr(0)&"' order by pro_id desc"
else
Dim strSQL As String = "Select * From table_pro where pro_sort_two ='"& sorttwo &"' and pro_vip = '"&cstr(0)&"' order by pro_id desc"
end if
'************************
改成只要其中一句,如:
Dim strSQL As String = "Select * From table_pro where pro_vip = '"&cstr(0)&"' order by pro_id desc"
又不会出错,这是什么原因?
要怎么修改呢?
strSQL = "Select * From table_pro where pro_vip = '"&cstr(0)&"' order by pro_id desc"
else
strSQL = "Select * From table_pro where pro_sort_two ='"& sorttwo &"' and pro_vip = '"&cstr(0)&"' order by pro_id desc"
end if这样呢?
楼主把strSQL定义在if语句上面就可以了.
if Request.QueryString("sorttwo") ="" then//这个是赋值,不是比较吧?