huckfinn19
Programmer
Hi!
Here's my problem: I currently fill a single column in a DataSet from an SQL DB. I can get up to 10000 records. So I have a Table in the DataSet like this:
|MyCol|
---------
Val1
Val2
...
The thing is that in my case, it would be very helpful to have another column containing boolean values to display in a DataGrid and let the users select some of the values in my DataSet. The result would be something like:
|Selected|MyCOl|
----------------
true | Val1 |
...
So far, I create another DataTable after my DataSet has retrieved the data (MyCol) values, I add 2 columns in that table, one boolean, one string, and I loop through the two DataSets to copy the Data. I find this incredibly expensive and I believe there must be another way somehow!
1- When loading data in the DataSet, can I tell it in which column the Data should be filled in? This way I could create the two tables and fill in only the second one.
2- Is there a way to copy the Data in a column from a DataSet to another? Should I use different data structures?
3- Could I tweak my SQL command so that I would retrive an artificial bool value in the first row? (something like: SELECT 1>0, MyCol FROM MyTable)
4- Any other idea on how I could do this?
Thanks in advance!
Huck
Here's my problem: I currently fill a single column in a DataSet from an SQL DB. I can get up to 10000 records. So I have a Table in the DataSet like this:
|MyCol|
---------
Val1
Val2
...
The thing is that in my case, it would be very helpful to have another column containing boolean values to display in a DataGrid and let the users select some of the values in my DataSet. The result would be something like:
|Selected|MyCOl|
----------------
true | Val1 |
...
So far, I create another DataTable after my DataSet has retrieved the data (MyCol) values, I add 2 columns in that table, one boolean, one string, and I loop through the two DataSets to copy the Data. I find this incredibly expensive and I believe there must be another way somehow!
1- When loading data in the DataSet, can I tell it in which column the Data should be filled in? This way I could create the two tables and fill in only the second one.
2- Is there a way to copy the Data in a column from a DataSet to another? Should I use different data structures?
3- Could I tweak my SQL command so that I would retrive an artificial bool value in the first row? (something like: SELECT 1>0, MyCol FROM MyTable)
4- Any other idea on how I could do this?
Thanks in advance!
Huck