Re: Performing Lookups on Dataset

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Hemang Shah (hemang_at_hemang.net)
Date: 03/16/05


Date: Wed, 16 Mar 2005 17:46:16 -0500

Does the Lookup table have to be indexed on typeid ?

or sorted ? or any restriction ?

"Saravanan K V" <SaravananKV@discussions.microsoft.com> wrote in message
news:972BC728-24C9-40EC-9444-9E887FE2C106@microsoft.com...
> Hi,
>
> You can use Find method of Rows Collection in the DataTable like this:
>
> DataRow dr = Lookup.Rows.Find(typeid);
> String TypeName = dr["TypeName"];
>
>
> Regards,
> Saravanan K V
>
> "news.microsoft.com" wrote:
>
>> Thanks Val
>>
>> That would be easy.
>>
>> However the first table has multiple fields of ID thas has the
>> corresponding
>> name in the lookup table.
>>
>> I can't have multiple Joins on all these fields between the same two
>> table
>> right ?
>>
>> That was the reason for my lookup function.
>>
>> Any ideas ?
>>
>> "Val Mazur (MVP)" <group51a@hotmail.com> wrote in message
>> news:O%23NETlcKFHA.508@TK2MSFTNGP12.phx.gbl...
>> > Hi,
>> >
>> > If these two tables are in a database then when you select data you
>> > could
>> > join these two tables using next kind of SQL statement and it will
>> > bring
>> > all the related descriptions for the types
>> >
>> > SELECT Customer.*, Lookup.TypeName FROM Customer LEFT JOIN Lookup ON
>> > Customer.CustTypeID1=Lookup.TypeID
>> >
>> > --
>> > Val Mazur
>> > Microsoft MVP
>> >
>> > http://xport.mvps.org
>> >
>> >
>> >
>> > "Hemang Shah" <hemang@hemang.net> wrote in message
>> > news:B_ydnTTY_9297KrfRVn-qw@rogers.com...
>> >> In the customer table, the primary key of the lookup table is stored.
>> >>
>> >> e.g:
>> >>
>> >> Table Customer
>> >>
>> >> CustTypeID1
>> >> CustTypeID2
>> >> ...
>> >>
>> >>
>> >> Table Lookup
>> >>
>> >> TypeID
>> >> TypeName
>> >>
>> >>
>> >>
>> >> Now in report or on the form, is there a quickway to do a lookup on
>> >> table
>> >> Lookup by the id ?
>> >>
>> >> I want a function like this:
>> >>
>> >> TypeName = Lookup(typeid);
>> >>
>> >> So that I can use this in crystal reports and also on the forms..
>> >>
>> >> Any suggestions would be welcome.
>> >>
>> >> Thanks
>> >>
>> >>
>> >
>> >
>>
>>
>>



Relevant Pages

  • Re: Performing Lookups on Dataset
    ... However the first table has multiple fields of ID thas has the corresponding ... That was the reason for my lookup function. ... > SELECT Customer.*, Lookup.TypeName FROM Customer LEFT JOIN Lookup ON ... >> So that I can use this in crystal reports and also on the forms.. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Keep lookup values constant
    ... lookup value increment while the lookup vector and result vector ... I entered a lookup function that works the way I need it to. ... now apply this function to the remaining cells in a column beneath ...
    (microsoft.public.excel.misc)
  • Re: Keep lookup values constant
    ... lookup value increment while the lookup vector and result vector ... I entered a lookup function that works the way I need it to. ... now apply this function to the remaining cells in a column beneath ...
    (microsoft.public.excel.misc)
  • RE: Nested If Loop Limitation for Excel 2003
    ... "If the LOOKUP function can't find the lookup_value, ... If lookup_value is smaller than the smallest value in lookup_vector, ... "raj74" wrote: ... THKprov = 8 ...
    (microsoft.public.excel.misc)
  • Re: Using an Excel Sheet in a custom outlook form
    ... I just added a simple Lookup() with source and results ranges to my form's ... > There is an existing excel sheet. ... > except the Lookup function. ... > function has nothing to do with the spreadsheet. ...
    (microsoft.public.outlook)