Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit records insertion

Status
Not open for further replies.

Bkster

Technical User
Jan 25, 2002
94
US
It will be easier if I explain what I am trying to do. I am building a system where people will sign up for jobs. A job may have more than one opening. Say I need 5 people to work at a certain location. My idea is that I will build a jobs table (using SQL Server) in this table will be a field for number of people needed for this job. Now when I build the jobs available page (asp) I need the this job to "not show " if 5 people have already signed up for it. Do I build a query that says when field "people needed" is = or greater than what ever number is listed in the field do not show. Iam I thinking in the right direction? I am just not sure how to write the query as the number in the people needed field could be different for each job. Any help would greatly be apreciated.

Thanks

Brian
 
Depending on how you're coding the field with those that have already signed up you'll need to do:

Select * from table where field is null

Assuming you're leaving the non-selected field empty.
[tt]
"The only ideas that will work for you are the ones you put to work."
[/tt]

banana.gif
rockband.gif
banana.gif

 
yep pretty much.

on your build location - well we're getting into hand coding here.

but you can have a form to enter jobs - and a text box for the number of jobs available. Where you would enter 1 to say 99 for that one job.

Now, when you build your entry page, you'd need to loop through the insertion x times - wher x= the number you put in.

So your form is a regular form - and say you submit it to pagetwo.asp

on page two you'd want something like this.


<% Dim strRowCount
strRowCount=request.form(&quot;numberfield&quot;)
%>
<%
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open &quot;DSN=mydsn;&quot;
FOR i = 1 to strRowCount

SQLStmt = &quot;UPDATE tblJobs &quot;
SQLStmt = SQLStmt & &quot;SET fldJobTitle='&quot; & Request.Form(&quot;txtJobTitle&quot;) & &quot;'&quot;
SQLStmt = SQLStmt & &quot;,fldDetail='&quot; & Request.Form(&quot;txtJobDates&quot;) & &quot;'&quot;

Set RS = Conn.Execute(SQLStmt)
'Response.Write SQLStmt
Next
set rs=nothing
Conn.Close
set conn=nothing
%>


Ok that will loop through however many times you specified with your info and enter away. - now note this can be tricky at first, but it's not too bad, so hollar if you run into problems.

Then to display - you'd do exactly as Tony mentioned, I'd make an Access Query on available jobs - (only showing the non-filled ones), and display away.

&quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top