Due to business requirements outside of my control, I need to assign order numbers to orders in distinct ranges based on which supplier's product they are for. Thanks to the help of the good people here, I have been able to do this...for one order at a time. I would appreciate any help on the best way to insert multiple orders (say, 20 at a time max) that would guarantee that they are consecutive numbers, which I assume would mean rolling it all up inside a transaction. Anyway...

I have a table called dbo.zstlkpOrd_NoRange that has the following fields:
Ord_NoRangeName varchar(50)
Ord_NoRangeMin int
Ord_NoRangeMax int
The table's data looks like this, (ranges aren't necessarily consecutive in actual database)
ProductA,        1,  500000
ProductB,  1000000, 2999999
ProcuctC,  3500000, 3999999
And the stored procedure that I use to insert records into my Orders table looks like this:
ALTER PROCEDURE dbo.spInsertReleaseNumbers
	(@chvOrd_NoRangeName varchar(50),
	@chvItem_No varchar(15),
	@intQty int)



	DECLARE @intOrd_NoRangeMin as int
	DECLARE @intOrd_NoRangeMax as int
	DECLARE @intOrd_NoNew as int
	--Lookup Order No. Range Minimum
	Set @intOrd_NoRangeMin = (SELECT Ord_NoMin
					FROM dbo.zstlkpOrd_NoRange
					WHERE company = 'data_05' AND item_desc = @chvRange)
	--Lookup Order No. Range Maximum
	Set @intOrd_NoRangeMax = (SELECT Ord_NoMax
					FROM dbo.zstlkpOrd_NoRange
					WHERE company = 'data_05' AND item_desc = @chvRange)
	--Get the next order number in that range
	Set @intOrd_NoNew = (SELECT MAX(ord_no)
				FROM dbo.MC_ReleaseNumbers_fn(@chvCompany)
				WHERE ord_no between @intOrd_NoRangeMin AND @intOrd_NoRangeMax) + 1
	--Add New Order to Orders table
	INSERT INTO dbo.Orders (ord_no, item_no, qty)
	VALUES (@intOrd_NoNew, @chvItem_No, @intQty)

How can I pass this procedure @intNumberOfOrders and have it insert multiple rows with consecutive order numbers?
I have more experience with VB, so my first thought would be something along the lines of:
 For Each OrderNo from 1 to @intNumberOfOrders
Also, since this code will be called from an ADP, would it be any easier to handle the looping and transaction stuff in VB and use the stored procedure that I already have?

I'm all for learning new things, so I don't need the code written for me or anything, just some direction.

Thank you!!!