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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check database items before submitting a form

Status
Not open for further replies.

deadfish

Programmer
Nov 13, 2002
50
0
0
HK
Hi,

I have a form that allow user to input 10 items and request quantity. I need to validate all the 10 items to make sure that the 10 items are exist in the database, and I need to notify the user for which item that are not valid. Do I need to loop through all the 10 items, submitting the query 1 item at a time to find out if the item exists or not?

If 40-50 (maximum) user connect to the site at the same time, and each of them are using this form to submit the 10 query , would the preformance be affected (I am using Access database)?

Any way to make this validation process much simplier?

Thanks a lot!
 
Access is NOT good for multi-user access. If you expect to have more than a couple people using the DB at once you really need to move to another system.

How large is the item list to begin with? If it is not very large then your best bet might be to download the item list into an array up front then do your comparison against that array rather than at the database. The GetString method is very useful for something like this.


Stamp out, eliminate and abolish redundancy!
 
how is your database structured...are all the 10 items in a single table and also the quantity you want to get displayed...

if so you can just do...

Select quantity from mytable WHERE
item1='"&request.form("item1")&"' AND
item2='"&request.form("item1")&"' AND
item3='"&request.form("item1")&"' AND
...and so on until ten items...

but this above will not tell you which item is not being correctly entered...

-DNG
 
Thanks!

I know Access is not good for handling multi user, but due to the budget, I have to use it..[sad]

I have nearly 200 items in my database item list...

The 10 items will be read from user's input, varify all of them to make sure the 10 items and the inputted quantity are valid, and then save into the Access table.

Which is the better way to varify all the items as well as telling the user which items are not valid?

Thanks in advance.



 
200 items is not a lot.
You can read them from the database into an array when the page loads then compare the items typed in by the user against the array before the form is allowed to submit.

Look into the GetString method for pulling the data and storing it.

Another approach would be to get the user entered data then do an XMLHTTP request to check the values and return the results to the current page before submitting but I think that is more complex than you need for this.


Stamp out, eliminate and abolish redundancy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top