Results 1 to 3 of 3

Thread: access & EOF , RESPONSE.REDIRECT

  1. #1
    aia Guest

    Default access & EOF , RESPONSE.REDIRECT

    I am trying to figure out whether a users name exists in the DB.<BR>If it does i send him to a different page telling him to choose a different name.<BR>If the name does not exist i place cookies relevant to his details then show him the entire page.<BR>there is no error but it ignores the RESPONSE.REDIRECT whenever a person places a name which already exists.<BR>Here is the code-<BR>&#060;%<BR>Set cn=server.CreateObject("ADODB.Connection")<BR>cn.o pen ("DSN=mybooks")<BR>Set rc=Server.createObject("ADODB.Recordset")<BR>rc.Ac tiveConnection=cn<BR> "Select * FROM users WHERE fname=&#039" & Request.Querystring("fname") & "&#039"<BR>If rc.eof Then<BR>cn.Execute "insert into users values(&#039 " & request.querystring("fname") & " &#039 , &#039 " & request.querystring("lname") & "&#039, &#039 " & request.querystring("email") & "&#039 , &#039 " & request.querystring("password") & "&#039)"<BR>rc.close<BR>response.Cookies("users")( "fname")=request.querystring("fname")<BR>response. Cookies("users")("lname")=request.querystring("lna me")<BR>response.Cookies("users")("email")=request .querystring("email")<BR>response.Cookies("users") ("password")=request.querystring("password")<BR>re sponse.Cookies("users").Expires=#1/1/2004#<BR>Else<BR>Response.Redirect "noentry.asp"<BR>End If<BR>%&#062;<BR>

  2. #2
    ASPMentor Guest

    Default RE: access & EOF , RESPONSE.REDIRECT

    Try this in the if statement:<BR><BR>if rc.BOF And rc.EOF Then<BR><BR> &#060;.. block of code ..&#062;<BR><BR>Else<BR><BR> Response.Redirect("noentry.asp")<BR><BR>End If

  3. #3
    aia Guest

    Default RE: access & EOF , RESPONSE.REDIRECT

    hey!thanks but i figured out what the problem is!<BR>i work with access 2000, every name listed in the fname column is inserted so that there is a single space before the beginning of it.<BR>so what happends is that the code i wrote works perfectly if i insert an existing name in the db, only when a single space<BR>is before that.<BR>so, the problem now is how do i tell access to treat the fname querystring as if it has a single space added to any fname.<BR>thanks, aia.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts