Problem with a VB script

  • Thread starter Thread starter Markus
  • Start date Start date
M

Markus

Hallo

I hope some one can help me i have problem with the following code it
sometimes works and sometimes it does not. Basicly what it does it looksup a
User ID in a table CDS that needs to match the string cdsid and if it matches
keep loading the page if they do not match go do the redirect some some
casses it works fine but then i have casses where it does not work even do
the User-ID is in the table.

<%
Dim rs2, strPfadDB2, SQL2
strPfadDB2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("\fpdb\CDS_Table.mdb") & _
";Mode=ReadWrite;Persist Security Info=False"
SQL2 ="SELECT CDS.CDSID " & _
"FROM CDS " & _
"WHERE CDS.CDSID='" & cdsid & "'"

set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.Open SQL2, strPfadDB2, 1, 2
IF NOT rs2.eof then
else
response.redirect ("WERSAuditE.asp")
end if
rs2.Close
set rs2 = nothing

%>
 
Where and how are you getting the value for: cdsid
From a form or query string
- and are you preprocessing it to make sure it is a text string

Also if it is text, it is case sensitive so try

"WHERE Lcase(CDS.CDSID)='" & Lcase(cdsid) & "'"
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


Hallo

I hope some one can help me i have problem with the following code it
sometimes works and sometimes it does not. Basicly what it does it looksup a
User ID in a table CDS that needs to match the string cdsid and if it matches
keep loading the page if they do not match go do the redirect some some
casses it works fine but then i have casses where it does not work even do
the User-ID is in the table.

<%
Dim rs2, strPfadDB2, SQL2
strPfadDB2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("\fpdb\CDS_Table.mdb") & _
";Mode=ReadWrite;Persist Security Info=False"
SQL2 ="SELECT CDS.CDSID " & _
"FROM CDS " & _
"WHERE CDS.CDSID='" & cdsid & "'"

set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.Open SQL2, strPfadDB2, 1, 2
IF NOT rs2.eof then
else
response.redirect ("WERSAuditE.asp")
end if
rs2.Close
set rs2 = nothing

%>
 
Back
Top