Solved

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

Posted on 2004-04-29
3
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 20 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 33

Expert Comment

by:Big Monty
ID: 10952456
cheers!

B.D.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JS does not refresh 6 42
innerHTML 7 45
Button function on table is in trouble 3 39
Boolean 13 46
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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