Re: Please help with If Then Else code
- From: robert <club_obi_wan@xxxxxxxxxxx>
- Date: Wed, 19 Sep 2007 07:21:59 -0700
On Sep 19, 3:22 am, "Stefan B Rusynko" <sbr_en...@xxxxxxxxxxx> wrote:
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_...@xxxxxxxxxxx> wrote in messagenews: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
|
I swear that didnt work yesterday! I must have typed something wrong
when I tested it. THANKS!
.
- References:
- Please help with If Then Else code
- From: robert
- Re: Please help with If Then Else code
- From: Stefan B Rusynko
- Please help with If Then Else code
- Prev by Date: Re: Please help with If Then Else code
- Next by Date: Re: Own message in status bar
- Previous by thread: Re: Please help with If Then Else code
- Index(es):
Relevant Pages
|