Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I need the SQL for select max+1 for my ASP page.

Posted on 2004-04-29
3
Medium Priority
?
261 Views
Last Modified: 2008-02-26
I have a HTML form that's saving data into a MS Access database using ASP.  The users need to see the next ID number on the form before the id number is created in the database.  I know this is just a simple select statement, but I can't seem to figure it out.

Here's what I've got:

---------------------------------------------------------------------------------------------------
'Initialize the strSQL variable with an SQL statement to query the database
strSQL1 = "SELECT max(its_number)+1 FROM tasks"

rsTask1.Open strSQL1, adoCon1

Response.Write strSQL1
---------------------------------------------------------------------------------------------------

I also need to do a response.write, and get that value printed out to the screen.  As of right now, my response.write just prints the sql.

Any help is greatly appreiciated!!
0
Comment
Question by:scross1276
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Big Monty earned 80 total points
ID: 10952412
just add 1 in asp to the field:

'Initialize the strSQL variable with an SQL statement to query the database
strSQL1 = "SELECT max(its_number) FROM tasks"

rsTask1.Open strSQL1, adoCon1

Response.Write CInt(rsTask1(0)) + 1
0
 

Author Comment

by:scross1276
ID: 10952423
Sweet, it worked perfectly, thanks!!
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 10952456
cheers!

B.D.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question