|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Count records with SQL & redirect with ASP
<i><b>Originally posted by : Michelle (mrhudy@leiner.com)</b></i><br />Help!<br />I am trying to create code in ASP using SQL - here's the story:<br /><br />I have a registration DB in Access 97 that you can sign up for on our intranet. First, you sign in with your UserID (usrname), then go to the course list. In the form to sign up, you enter the CourseID and then I have code on the summary page that first makes sure it is valid, then it checks to see if your UserID has not signed up for the same course, then enters it in the DB, then displays the new record entry. <br /><br />I want to add code that makes sure no more than 25 people have signed up for the class.<br /><br />This is what I used for the no duplicate entry - can this be modified to use the SELECT COUNT feature and redirect the user if there are already 25 of that courseID in the DB???<br /><br />Dim strRedirect<br />strRedirect = "<script>javascript:window.open('state_search2.asp?usrName= " & strUserName & "','_top');</script>"<br /><br />Set rs = Conn.Execute("SELECT * FROM SignUp " & _<br /> "WHERE SignUp.ID = '"&strUserName&"' "& _<br /> "AND SignUp.CourseID LIKE '"&CourseID&"'")<br />If Not rs.EOF Then<br />Response.Write(strRedirect)<br />End If<br />Set rs = Conn.Execute("SELECT * FROM Employees WHERE ID = '"&strUserName&"'")<br /><br />Thanks a million to anyone who takes the time to help me!<br /><br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : </b></i><br /><br /><br /><br />------------<br />Michelle at 5/4/2001 1:13:05 PM<br /><br />Help!<br />I am trying to create code in ASP using SQL - here's the story:<br /><br />I have a registration DB in Access 97 that you can sign up for on our intranet. First, you sign in with your UserID (usrname), then go to the course list. In the form to sign up, you enter the CourseID and then I have code on the summary page that first makes sure it is valid, then it checks to see if your UserID has not signed up for the same course, then enters it in the DB, then displays the new record entry. <br /><br />I want to add code that makes sure no more than 25 people have signed up for the class.<br /><br />This is what I used for the no duplicate entry - can this be modified to use the SELECT COUNT feature and redirect the user if there are already 25 of that courseID in the DB???<br /><br />Dim strRedirect<br />strRedirect = "<script>javascript:window.open('state_search2.asp?usrName= " & strUserName & "','_top');</script>"<br /><br />Set rs = Conn.Execute("SELECT * FROM SignUp " & _<br /> "WHERE SignUp.ID = '"&strUserName&"' "& _<br /> "AND SignUp.CourseID LIKE '"&CourseID&"'")<br />If Not rs.EOF Then<br />Response.Write(strRedirect)<br />End If<br />Set rs = Conn.Execute("SELECT * FROM Employees WHERE ID = '"&strUserName&"'")<br /><br />Thanks a million to anyone who takes the time to help me!<br /><br />
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Count records with SQL & redirect with ASP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|