Search Results

Search found 8 results on 1 pages for 'user320587'.

Page 1/1 | 1 

  • Handle Union of List in C# with duplicates

    - by user320587
    Hi, I am trying to understand how to handle union or merge of two lists that can have duplicates. For example, List1 has { A, B, C} and List2 has { B, C, D }. I tried to use the Union operation and got a new list with values (A, B, C, D}. However, I need the B & C values from the second list, not first one. Is there a way to specify the union method, which duplicate value to use. The code I am using now is var newList = List1.Union<Object>(List2).ToList(); Thanks for any help. Javid

    Read the article

  • How to merge two didctionaries in C# with duplicates

    - by user320587
    Hi, Is there a way in C# to merge two dictionaries? I have two dictionaries that may has the same keys, but I am looking for a way to merge them so, in the end there is a dictionary with one key and the values from both the dictionaries merged. I found the following code but it does not handle duplicates. Dictionary Mydictionary<string, string[]> = new Dictionary<string, string[]>(); Mydictonary.Union(secondDictionary).ToDictionary( pair => pair.Key, pair => pair.Value);

    Read the article

  • Algorithm to create a linked list from a set of nodes

    - by user320587
    Hi, I am looking for an algorithm to create a linked list from a set of nodes. For example, let's assume a node is an airline ticket from a source point to destination. (e.g., Chicago to Detroit) and there are several airline tickets. Assuming all these airline tickets are jumbled, what is the best way to determine the entire journey path. If there are 5 airline tickets like Chicago-Detroit, Denver-Chicago, Detroit-DC, DC-New York, San Jose-Denver, the algorithm should be able to come up with the correct start to end path. San Jose - Denver - Chicago - Detroit - DC - New York

    Read the article

  • How to find N Consecutive records in a table using SQL

    - by user320587
    Hi, I have the following Table definition with sample data. In the following table, Customer Product & Date are key fields Table One Customer Product Date SALE X A 01/01/2010 YES X A 02/01/2010 YES X A 03/01/2010 NO X A 04/01/2010 NO X A 05/01/2010 YES X A 06/01/2010 NO X A 07/01/2010 NO X A 08/01/2010 NO X A 09/01/2010 YES X A 10/01/2010 YES X A 11/01/2010 NO X A 12/01/2010 YES In the above table, I need to find the N or N consecutive records where there was no sale, Sale value was 'NO' For example, if N is 2, the the result set would return the following Customer Product Date SALE X A 03/01/2010 NO X A 04/01/2010 NO X A 06/01/2010 NO X A 07/01/2010 NO X A 08/01/2010 NO Can someone help me with a SQL query to get the desired results. I am using SQL Server 2005. I started playing using ROW_NUMBER() AND PARTITION clauses but no luck. Thanks for any help

    Read the article

  • How to get LastActivityDate when using Active Directory Setup in a .net application

    - by user320587
    Hi, I have a requirement to show a list of all users along with the Last Activity Date. The application is .Net based. I found the MemberShip class provides the Last Activity date. However, this does not work when the MemberShip provider is ActiveDirectory Link to MSDN page because the ActiveDirectoryMemberShipUser does not implement the LastActivityDate property. Is there any workaround or other way, I can get the LastActivityDate of the user in the application. Thanks for any info

    Read the article

  • How to commit inside a CURSOR Loop?

    - by user320587
    Hi, I am trying to see if its possible to perform Update within a cursor loop and this updated data gets reflected during the second iteration in the loop. DECLARE cur CURSOR FOR SELECT [Product], [Customer], [Date], [Event] FROM MyTable WHERE [Event] IS NULL OPEN cur FETCH NEXT INTO @Product, @Customer, @Date, @Event WHILE @@FETCH_STATUS = 0 BEGIN SELECT * FROM MyTable WHERE [Event] = 'No Event' AND [Date] < @DATE -- Now I update my Event value to 'No Event' for records whose date is less than @Date UPDATE MyTable SET [Event] = 'No Event' WHERE [Product] = @Product AND [Customer] = @Customer AND [Date] < @DATE FETCH NEXT INTO @Product, @Customer, @Date, @Event END CLOSE cur DEALLOCATE cur Assume when the sql executes the Event column is NULL for all records In the above sql, I am doing a select inside the cursor loop to query MyTable where Event value is 'No Event' but the query returns no value even though I am doing an update in the next line. So, I am thinking if it is even possible to update a table and the updated data get reflected in the next iteration of the cursor loop. Thanks for any help, Javid

    Read the article

  • Is there a way to rewrite the SQL query efficiently

    - by user320587
    hi, I have two tables with following definition TableA TableB ID1 ID2 ID3 Value1 Value ID1 Value1 C1 P1 S1 S1 C1 P1 S2 S2 C1 P1 S3 S3 C1 P1 S5 S4 S5 The values are just examples in the table. TableA has a clustered primary key ID1, ID2 & ID3 and TableB has p.k. ID1 I need to create a table that has the missing records in TableA based on TableB The select query I am trying to create should give the following output C1 P1 S4 To do this, I have the following SQL query SELECT DISTINCT TableA.ID1, TableA.ID2, TableB.ID1 FROM TableA a, TableB b WHERE TableB.ID1 NOT IN ( SELECT DISTINCT [ID3] FROM TableA aa WHERE a.ID1 == aa.ID1 AND a.ID2 == aa.ID2 ) Though this query works, it performs poorly and my final TableA may have upto 1M records. is there a way to rewrite this more efficiently. Thanks for any help, Javid

    Read the article

  • Core Data Change property value when another property changes

    - by user320587
    Hi, I have a Core Data Entity which has three properties startDate, endDate and duration. All three properties are persistent properties. I would like to know how I can calculate and update the duration property whenever the value for startDate and endDate changes? BTW, I won't be able to make the duration as transient property since I have to use the property for sorting in my table view? Any help is greatly appreciated Thanks, Javid

    Read the article

1