PDA

Click to See Complete Forum and Search --> : Database Questions...


Jan 6th, 2001, 07:24 PM
First Question:

I have an Access Database with products. They are shoes actually. Now there is a dropdown list that has to be filled with the shoe sizes available for each shoe. I don't know what the easiest way to do this is. I was thinking of having a field named "Sizes" in the database table. The field would contain all of the sizes that the shoe is available in, each size seperated by a comma or semi-colon.

So, for example, the "Sizes" field for a shoe would be "10,10.5,11,11.5,12,13,13.5". Then this information would be added to the listbox. What I don't understand is how to seperate the shoe sizes by commas and let the server know that the commas seperate the values. There must be some kind of function to do this.

Second Question:

What is the easiest way to find a record in a recordset? I have a value name "ItemNo" and all of the "ItemNo" are unique. Not one is the same. I was thinking of doing this in SQL:

Dim iNumber
Dim strSQL
iNumber = SH005
strSQL = "SELECT ItemNo FROM Shoes WHERE ItemNo = iNumber"

But the SQL statement doesn't work for some reason.

Thanks, your help would be greatly appreciated...

-Simon

Kagey
Jan 6th, 2001, 09:23 PM
to separate the sizes, use the split() function and each size would then be a different array element. you would then cycle throught the array and add each item to the list.
you could use a for each loop.

array = split(DBFIELD)


second:

use this sql statment

strSQL = "SELECT * FROM Shoes WHERE ItemNo='" & iNumber &"';"


the sql you had would look for the ItemNo that was iNumber, not the value it held. Also if the value is not an integer, you need to put single quotes around it._Also_ with your statment, only the actual ItemNo field would have been retrieved, not the whole record, which i assume you wanted.

Well, just some things to look out for. dont worry, once you do it a few times, its natural.

Jan 6th, 2001, 10:28 PM
Thank you very much!

This is my first week learning ASP, but I've got a steady grasp on it since I'm also a VB programmer.

Thanks again,

-Simon