Search through data returned from stored procedure

Discussion in 'ASP .Net' started by CSINVA, Nov 2, 2007.

  1. CSINVA

    CSINVA Guest

    I have a stored procedure that returns columns from a table called
    UserProfile. Within the table, it has a column called ProfielD,
    PropertyValue, Visitbility. I need to be able set the values returned
    to a variable to be used later. Here is an example of the data
    without filtering stored procedure:

    ProfileID, UserID, PropertyDefinitation, PropertyValue,Visibiity
    31, 3, 20, Prefix, 2
    32, 3, 22, Suffix, 2
    33, 3, 25, unit, 2
    34, 3, 30, zip, 2
    35, 4, 20, Prefix, 2
    36, 4, 22, Suffix, 2
    37, 4, 25, unit, 2

    I created the stored procedure to take a @userID parameter so only the
    rows with the appropriate userID would be displayed.

    So now my data looks like when filtered with userID = 3

    ProfileID, UserID, PropertyDefinitation, PropertyValue,Visibiity
    31, 3, 20, Prefix, 2
    32, 3, 22, Suffix, 2
    33, 3, 25, unit, 2
    34, 3, 30, zip, 2

    Now I need to:

    Assign the value in the PropertyValue column where it is equal to a
    particual number in the PropertyDefinitation column, such as:

    txtPrefix = Number 20 - Prefix
    txtPrefixVisibility = Number 20 - Visibility
    txtSuffix = Number 22 - Suffix
    txtPrefixVisibility = Number 22 - Visibility
    txtUnit = Number 25 - Unit
    txtUnitVisibility = Number 25 - Visibility
    txtZip = Number 30 - Zip
    txtZipVisibiity = Number 30 - Visibility
     
    CSINVA, Nov 2, 2007
    #1
    1. Advertising

  2. Have your data returned to a DataTable. Then you can use DataTable.Select
    method to locate required rows.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "CSINVA" <> wrote in message
    news:...
    >I have a stored procedure that returns columns from a table called
    > UserProfile. Within the table, it has a column called ProfielD,
    > PropertyValue, Visitbility. I need to be able set the values returned
    > to a variable to be used later. Here is an example of the data
    > without filtering stored procedure:
    >
    > ProfileID, UserID, PropertyDefinitation, PropertyValue,Visibiity
    > 31, 3, 20, Prefix, 2
    > 32, 3, 22, Suffix, 2
    > 33, 3, 25, unit, 2
    > 34, 3, 30, zip, 2
    > 35, 4, 20, Prefix, 2
    > 36, 4, 22, Suffix, 2
    > 37, 4, 25, unit, 2
    >
    > I created the stored procedure to take a @userID parameter so only the
    > rows with the appropriate userID would be displayed.
    >
    > So now my data looks like when filtered with userID = 3
    >
    > ProfileID, UserID, PropertyDefinitation, PropertyValue,Visibiity
    > 31, 3, 20, Prefix, 2
    > 32, 3, 22, Suffix, 2
    > 33, 3, 25, unit, 2
    > 34, 3, 30, zip, 2
    >
    > Now I need to:
    >
    > Assign the value in the PropertyValue column where it is equal to a
    > particual number in the PropertyDefinitation column, such as:
    >
    > txtPrefix = Number 20 - Prefix
    > txtPrefixVisibility = Number 20 - Visibility
    > txtSuffix = Number 22 - Suffix
    > txtPrefixVisibility = Number 22 - Visibility
    > txtUnit = Number 25 - Unit
    > txtUnitVisibility = Number 25 - Visibility
    > txtZip = Number 30 - Zip
    > txtZipVisibiity = Number 30 - Visibility
    >
     
    Eliyahu Goldin, Nov 4, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick
    Replies:
    2
    Views:
    5,969
    Gopinath S
    Feb 15, 2005
  2. wilco
    Replies:
    2
    Views:
    424
    Xavier MT
    Aug 5, 2003
  3. Patrick

    send email through stored procedure

    Patrick, Jan 24, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,145
    Steve C. Orr [MVP, MCSD]
    Jan 24, 2005
  4. asgars
    Replies:
    0
    Views:
    2,033
    asgars
    Jun 5, 2006
  5. Mike P
    Replies:
    0
    Views:
    3,334
    Mike P
    Jun 19, 2006
Loading...

Share This Page