Re: Please help with If Then Else code
- From: "Stefan B Rusynko" <sbr_enjoy@xxxxxxxxxxx>
- Date: Wed, 19 Sep 2007 04:22:59 -0400
For no records found should just be
<% If oRS.EOF then response.write "You have no membership"%>
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________
"robert" <club_obi_wan@xxxxxxxxxxx> wrote in message news:1190169580.076409.263510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|I cannot get these 'if then else response.write' codes to work can
| someone please help
|
| The database, I have two tables (relationship)
|
| contactTBL (one) and membershipTBL (many)
| contactTBL - primary key - contactID
| membershipTBL - foreign key - contactID
|
| All I want to do is set up a statement that returns a response.write
| "no memberhsip on file" if contactID is not in the membershipTBL - ie
| if the person has no membership, then their 'contactID' would not
| appear in the membershipTBL, and I would like to tell them when they
| login that 'You dont have any membership'
|
| Here is some code that may help, the site is protected by the
| contactID set as CID:
|
| <%Your_Name = request.cookies("remain")%>
| <%Date_In = request.cookies("still")%>
| <%CID = request.cookies("CID")%>
| <%If request.cookies("remain") = "" then response.redirect
| ("login.html")%>
| <%Dim MyLogin
|
| Set MyLogin = Server.CreateObject("ADODB.Connection")
| ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; "
| ConnStr = ConnStr & "DBQ=" & Server.MapPath("..\fpdb\aata.mdb")
| MyLogin.Open(ConnStr)
| %>
| </html>
| <body>
| <%dim oRS
| Set oRS= MyLogin.execute("Select * From membership_TBL WHERE
| contactID=" & CID & "")%>
| <%If oRS.EOF = " " AND oRS.BOF = " " then response.write "You have no
| membership"%>
|
| --
|
| The error is ADODB.Field error '80020009'
|
| Either BOF or EOF is True, or the current record has been deleted.
| Requested operation requires a current record
|
| Note there is another connection above this in the code to another
| table in the database, that code is:
|
| <%Dim RS
| Set RS = MyLogin.execute("SELECT * FROM contactTBL WHERE contactID=" &
| CID & "")
| %>
| Welcome, <%=Your_Name%>
|
| Thanks in Advance
| Rob
|
.
- Follow-Ups:
- Re: Please help with If Then Else code
- From: robert
- Re: Please help with If Then Else code
- References:
- Please help with If Then Else code
- From: robert
- Please help with If Then Else code
- Prev by Date: Please help with If Then Else code
- Next by Date: Re: Please help with If Then Else code
- Previous by thread: Please help with If Then Else code
- Next by thread: Re: Please help with If Then Else code
- Index(es):
Relevant Pages
|