ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 21st, 2003, 11:39 PM
amenon amenon is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 2 amenon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Creating a login with access

I am trying to create a login based on 2 tables...1. Members 2. Register. My code first checks the Members table to see if the memberno exist. If not it returns an error message. Then it checks to see if the member is already registered from the register table. if the member is registered it gives an error msg. If the member is in the member table and is not registered, it lets the member create an account in the register table... However I am unable to insert a record into the table....below is my code...Any help will be appreciated...
--------------------------------------------
<%if Request.QueryString("return")="yes" then

bMemberNo= trim(Request.Form("bMemberNo"))
BclubName= trim(Request.Form("BclubName"))
bUserName = trim(Request.Form("bUsername"))
bpassword=trim(Request.Form("bpassword"))
bfirstname=trim(Request.Form("bfirstname"))
bLastname=trim(Request.Form("bLastname"))

%>
<%

set MemberSearch=server.CreateObject("ADODB.recordset")
set CustomerSearch=server.CreateObject("ADODB.recordset")

'SqlMember="Select memberid,memberno,clubno from members where memberno='"&bMemberNo&"'and clubno='"&BclubName&"'"
MemberSearch.Open "Select memberid,memberno,clubno from members where memberno='"&bMemberNo&"'and clubno='"&BclubName&"'",Application("login_ConnectionString")
if not MemberSearch.EOF then
bchecked=1

bMemberid=MemberSearch.Fields("memberid")
MemberNo=MemberSearch.Fields("memberno")
clubno=MemberSearch.Fields("clubno")
'SqlSelect="Select * from register where MemberNo='"&MemberNumber&"'and clubno='"&clubno&"'"
CustomerSearch.Open "Select * from register where MemberNo='"&MemberNo&"'and clubno='"&clubno&"'",Application("login_ConnectionString")

if CustomerSearch.RecordCount>0 then
session("MemberRegistered")=1
response.Redirect "ClubMemberSign_copy(2).asp?&bUserName="&bUserName&"&bmemberno="&bMemberno&"&bclubno="&bclubName&"&bFirstName="&bFirstname&"&bLastName="&bLastName&""
end if

CustomerSearch.Open "INSERT into register (MemberNo,clubno,firstname,lastname,email,password ,checked) values ('"&MemberNo&"','"&clubno&"','"&bfirstname&"','"&blastname&"','"&bemail&"',"&bchecked&")",Application("login_ConnectionString")
'myconn.execute(SqlInsert)
'CloseConnection myconn
Response.Redirect("ClubRegSuccess.asp")
else

session("MemberCheck")=1
response.Redirect "ClubMemberSign_copy(2).asp?&bUserName="&bUserName&"&bmemberno="&bMemberno&"&bclubno="&bclubName&"&bFirstName="&bFirstname&"&bLastName="&bLastName&""

end if
'CloseConnection myconn

end if
%> <html>

<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body bgcolor="white">

<center>
<p><br>
<strong><font color="#000066">Enter Your Details Here !!</font></strong> <br>
</p>
<p></p>
<table width="1157" border="0" cellspacing="2" cellpadding="0">
<tr align="left" valign="top">
<td width="189" height="438"></td>
<td width="529" height="178">
<form name="addressForm" action="ClubMemberSign_copy(2).asp?return=yes" method="post">
<%if session("count")=1 then
session("count")=0
Response.Write("<STRONG><font color=#70000>Sorry,Your Email Exists..Try Again !!</font></STRONG><br><br>")
end if
%>
<%
if session("memberRegistered")=1 then
session("memberRegistered")=0
Response.Write("<STRONG><font color=#70000>Sorry,You are already registered</font></STRONG><br><br>")

end if
%>



<%
if session("MemberCheck")=1 then
session("MemberCheck")=0
Response.Write("<STRONG><font color=#70000>Sorry,You Are Not A Registered Club Member ...</font></STRONG><br><br>")
end if
%>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="529">
<tr>
<td width="143"><font color="black" face="timesnewroman">Member Number</font></td>
<td width="383"><input name="bMemberno" size="20"> </td>
</tr>
<tr>
<td width="250"><font color="black" face="timesnewroman">ClubName</font></td>
<td width="195">
<%
set recordClub=server.CreateObject("ADODB.Recordset")
recordClub.Open "select * from ClubDetails order by clubname",Application("login_ConnectionString") %> <select id="select1" name="bClubName">
<%while not recordClub.EOF %>
<option value="<%=recordClub.Fields("clubno")%>">
<%=recordClub.Fields("clubname")%></option>
<%


recordClub.MoveNext()
wend
%></select></td>
</tr>
<tr>
<td width="250"><font color="red" face="timesnewroman">E-MailAddress</font></td>
<td width="195">
<input name="bUserName" value="<%=request("bUserName")%>" size="20">
</td>
</tr>
<tr>
<td width="250"><font color="red" face="timesnewroman">Password</font></td>
<td width="195"><nobr>
<input type="password" name="bpassword" size="20">&nbsp;<font color="#7f7f7d" size="2">(*
atleast 4 characters )</font></nobr> </td>
</tr>
<tr>
<td width="250"><font color="red" face="timesnewroman"><nobr>
Re-enterPassword</nobr></font></td>
<td width="195"><input type="password" name="bpasswordNew" size="20">
</td>
</tr>
<tr>
<td width="250"><font color="black" face="timesnewroman">First Name</font></td>
<td width="195">
<input name="bFirstName" value="<%=request("bFirstname")%>" size="20">
</td>
</tr>
<tr>
<td width="250"><font color="black" face="timesnewroman">Last Name</font></td>
<td width="195">
<input name="bLastName" value="<%=request("bLastName")%>" size="20">
</td>
</tr>
<tr>
<td width="143">&nbsp;</td>
</tr>
</table>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<p>&nbsp;</td>
<td width="431" height="438">&nbsp;</td>
</tr>
</table>
</center>

</body>

</html>

Reply With Quote
  #2  
Old March 22nd, 2003, 11:23 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 8
Send a message via MSN to aspnewbie
I think the problem is with this set of code? Right now you say if the member is registered then you redirect to a signup form with all the info. Then you have an end if. After which you have the insert statement and then you have your else statement (if they are a member but not registered). So your insert statement is never triggered.

Code:

if CustomerSearch.RecordCount>0 then
session("MemberRegistered")=1
response.Redirect "ClubMemberSign_copy(2).asp
&bUserName="&bUserName&"&bmemberno="&bMemberno
&"&bclubno="&bclubName&"&bFirstName="&bFirstname&"&
bLastName="&bLastName&""
end if

CustomerSearch.Open "INSERT into register
(MemberNo,clubno,firstname,lastname,email,password  
,checked) values
'"&MemberNo&"','"&clubno&"','"&bfirstname&"','"&blastname&"','"
&bemail&"',"&bchecked&")",Application("login_ConnectionString") 
'myconn.execute(SqlInsert)
'CloseConnection myconn
Response.Redirect("ClubRegSuccess.asp")

else

session("MemberCheck")=1
response.Redirect "ClubMemberSign_copy(2).asp
&bUserName="&bUserName&"&bmemberno="&bMemberno&"&
bclubno="&bclubName&"&bFirstName="&bFirstname&"&
bLastName="&bLastName&""

end if



I'm thinking what you could do is an elseif session("MemberCheck") = 0 then do the insert. That way you can display your error message and have the form repopulated with all the info and then have insert done.


You are using a post and request.form, so I'm a little puzzled as to why you are passing the info as well in a querystring. But I haven't tried this myself so maybe you have a reason for it??? If you just submitted the form to itself, then presumably you won't need to use a response.redirect? I try as far as possible to avoid passing info (particular username etc in querystrings because of the potential for SQL injection attacks.)

Last edited by aspnewbie : March 22nd, 2003 at 11:37 AM.

Reply With Quote
  #3  
Old March 23rd, 2003, 04:47 PM
amenon amenon is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 2 amenon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thank you for your response...i shall try that and see

Reply With Quote
  #4  
Old March 23rd, 2003, 07:23 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
just on the 2 table situation - sounds like there's a lot of redundant data occurring. Why are you using 2 tables? Why not just use a boolean (true/false) field in the members table to represent whether or not someone is registered?

Reply With Quote
  #5  
Old April 3rd, 2003, 09:47 AM
bacliqe bacliqe is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: UK
Posts: 1 bacliqe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yo man help me i am new to VB.NET

Can you send me that example you doing Members and registors table. I need to learn these things

Also if any one have any VB with Access that includes reservation system like a hotel management system or any other reservation system, if they can give to me it would be a graet help.

Thank you ALL

My E-mail: URL

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Creating a login with access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek