Create and read from an array of integers

Last post 09-19-2005 5:40 AM by RyanGiggs. 4 replies.

Sort Posts:

  • Create and read from an array of integers

    09-17-2005, 8:46 PM
    • Member
      365 point Member
    • RyanGiggs
    • Member since 10-14-2004, 6:28 PM
    • Posts 73
    Hi,

    I need to create an array of integers from a table then I need to read through those values and check if they match a query string.
    I've looked everywhere but am getting most confused.

    All help gratefully received.

    Regards,

    rg
    Whatsthehampton.com - A community server development project in asp.net (vb)
  • Re: Create and read from an array of integers

    09-18-2005, 12:57 AM
    • All-Star
      26,551 point All-Star
    • Caddre
    • Member since 06-23-2003, 9:53 AM
    • Indy
    • Posts 5,308

    Arrays are reference types so they are classes but integers are not classes in C# but structs and valuetypes.  But System.Collection defines three abstract base classes, CollectionBase, ReadOnlyCollectionBase and DictionaryBase which can be inherited and used to develop custom specialized collection.

    You can use System.Collections.CollectionBase and  CollectionBase.ICollection.CopyTo Method to pass ArrayList which is collection to one dimensional Array.  Try the links below the second link is for DictionaryBase, to get started.   The Querystring part is not covered in the links. Hope this helps.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionscollectionbaseclasstopic.asp

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionsdictionarybaseclasstopic.asp

    Kind regards,
    Gift Peddie
  • Re: Create and read from an array of integers

    09-18-2005, 7:47 AM
    • Member
      725 point Member
    • BobT
    • Member since 04-15-2005, 5:38 PM
    • Boston
    • Posts 143
    What do you mean create an array from a table?   A multidimensional array of the table's values?

    Also if you are going to match "integers" to a query "string" you got some converting to do.
    It's all over and I'm standin' pretty
    In this dust that was a city
    If I could find a souvenier
    Just to prove the world was here
  • Re: Create and read from an array of integers

    09-19-2005, 3:00 AM
    • Participant
      1,585 point Participant
    • smtraber
    • Member since 05-30-2005, 6:34 AM
    • California, US
    • Posts 344

    Can you explain a bit more? It should be easy to loop through a datatable from a datasource, and create an array from one or more columns, but what do you mean "check if they match a query string" there are numerous ways to retrieve only the record that matches the query string, so I'm curious what exactly you are trying to do?

    smtraber

    Victory is mine!!
  • Re: Create and read from an array of integers

    09-19-2005, 5:40 AM
    • Member
      365 point Member
    • RyanGiggs
    • Member since 10-14-2004, 6:28 PM
    • Posts 73

    Thanks all,

    I think I was going around this the wrong way anyway. I had a permissions table that held the userID and the ContentID of certain areas of content.
    I wanted to lookup in the permissions table whether or not that user could edit that content - so I though I'd make an array of all of the userID's and see if they matched the contentID's. (from the query string).

    I did it another way by cheking if that record (UserID and ContentID) exists and then granting permission if it did.
    It works, but not sure which way would be best.

    Thanks again,
    j

    Whatsthehampton.com - A community server development project in asp.net (vb)
Page 1 of 1 (5 items)