Results 1 to 3 of 3

Thread: Database Questions...

  1. #1
    Guest

    Question

    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

  2. #2
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    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.
    Code:
    array = split(DBFIELD)
    second:

    use this sql statment
    Code:
    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.


  3. #3
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width