How do I ...
-
Hello to all, I have an Access table with several rows in it and a boolean field (column) that only has one row (record) that is TRUE. Using C# how do I programmatically determine the row that is TRUE and get the index of that row? So far I am at: foreach (DataRow row in ds.Tables["currlist"].Rows I would assume this will go through each row and then find the row that is TRUE in the boolean field. If there is a different, better way please point me in the right direction. Thanks, BIll Antonacchio
-
Hello to all, I have an Access table with several rows in it and a boolean field (column) that only has one row (record) that is TRUE. Using C# how do I programmatically determine the row that is TRUE and get the index of that row? So far I am at: foreach (DataRow row in ds.Tables["currlist"].Rows I would assume this will go through each row and then find the row that is TRUE in the boolean field. If there is a different, better way please point me in the right direction. Thanks, BIll Antonacchio
Using a DataColumn might be quicker since you are searching for a particular value for only one attribute of the table, not sure though.
-
Hello to all, I have an Access table with several rows in it and a boolean field (column) that only has one row (record) that is TRUE. Using C# how do I programmatically determine the row that is TRUE and get the index of that row? So far I am at: foreach (DataRow row in ds.Tables["currlist"].Rows I would assume this will go through each row and then find the row that is TRUE in the boolean field. If there is a different, better way please point me in the right direction. Thanks, BIll Antonacchio
Try ds.Tables["currlist"].Select("whatyourfieldiscalled='true'"); Will return a DataRow, a much nicer way than using a linear search. Ryan
-
Try ds.Tables["currlist"].Select("whatyourfieldiscalled='true'"); Will return a DataRow, a much nicer way than using a linear search. Ryan
Hi Ryan, Thank you kindly for that. Will try to get this to give me the info needed. I need to rethink the question though. Will this give me the row number that contains the TRUE field? What I need to get is the index number of the row that contains the TRUE field. Regards, Bill Antonacchio
-
Hello to all, I have an Access table with several rows in it and a boolean field (column) that only has one row (record) that is TRUE. Using C# how do I programmatically determine the row that is TRUE and get the index of that row? So far I am at: foreach (DataRow row in ds.Tables["currlist"].Rows I would assume this will go through each row and then find the row that is TRUE in the boolean field. If there is a different, better way please point me in the right direction. Thanks, BIll Antonacchio