Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
heyy..

I have certain items in a list box and also I have certain items in a dataset..

I want items in list box that not in the dataset... I try ..but I don't get right annswer....

here is my code....:-


C#
if (dsExistingBillGeneration != null && dsExistingBillGeneration.Tables[0].Rows.Count > 0)
                {
                    List<BillGenerationLibrary> lstBillgen = new List<BillGenerationLibrary>();

                    for (int i = 0; i < dsExistingBillGeneration.Tables[0].Rows.Count; i++)
                    {

                     
                        var billdata = from lstbilldata in listBillGenerationLibrary where lstbilldata.IsDirectBilling == 1 && (lstbilldata.ApartmentId != Convert.ToInt32(dsExistingBillGeneration.Tables[0].Rows[i]["ApartmentId"])) select lstbilldata;
                        lstBillgen = billdata.ToList();

                    }
                    returnGroupId = objBillGenerationBussinessRules.Insert_ServiceManagement_BillGeneration(lstBillgen);
                }
Posted
Comments
PrissySC 8-Jun-13 8:23am    
What kind of results are you getting?


And why this? Convert.ToInt32(dsExistingBillGeneration.Tables[0].Rows[i]["ApartmentId"]))
Based on the naming conventions, is not ApartmentID a PK? It is already an int yes?

As well,
(lstbilldata.ApartmentId != Convert.ToInt32(dsExistingBillGeneration.Tables[0].Rows[i]["ApartmentId"]))
It looks like you have some type of relationship here. Yet, you want all records that are not equal to the ApartmentId in lstbilldata table? Is this an error on your part? Do you not want to match records for the apartment to the direct billing choice?

List<t> Methods ... http://msdn.microsoft.com/en-us/library/s6hkc2c4.aspx
Sunasara Imdadhusen 11-Jun-13 1:40am    
Are you getting any error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900