473,799 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Code to parse a SQL Result into list of datatables

Is there any code part of the .NET Framework or any suggestions at the
best way to handle the following situation?

Results from SQL Select statement:

MeasureDate | Name | Width | Height
01/01/07 | Flower | 10 | 10
01/01/07 | Tree | 11 | 11
01/01/07 | Bush | 12 | 12
02/01/07 | Flower | 11 | 10
02/01/07 | Tree | 12 | 11
02/01/07 | Bush | 13 | 12

I'd like a way to create the following structure:

A List (myList) that holds dataTables based on MeasureDate:

myList['01/01/07'] would hold a datatable

Flower | 10 | 10
Tree | 11 | 11
Bush | 12 | 12

Does that make sense?

Thanks

Sam

Jun 14 '07 #1
1 2194
Sam,

All you really need is a DataView for this. You can create two separate
DataViews on the same table, and set the filter on one to have a MeasureDate
of 1/1/07, and the filter on the other DataView to be a MeasureDate of
2/1/07. Then, you can use the DataView instances like you would DataTables.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Sam Shrefler" <ss*******@gmai l.comwrote in message
news:11******** *************@q 19g2000prn.goog legroups.com...
Is there any code part of the .NET Framework or any suggestions at the
best way to handle the following situation?

Results from SQL Select statement:

MeasureDate | Name | Width | Height
01/01/07 | Flower | 10 | 10
01/01/07 | Tree | 11 | 11
01/01/07 | Bush | 12 | 12
02/01/07 | Flower | 11 | 10
02/01/07 | Tree | 12 | 11
02/01/07 | Bush | 13 | 12

I'd like a way to create the following structure:

A List (myList) that holds dataTables based on MeasureDate:

myList['01/01/07'] would hold a datatable

Flower | 10 | 10
Tree | 11 | 11
Bush | 12 | 12

Does that make sense?

Thanks

Sam

Jun 14 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2404
by: chuck amadi | last post by:
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one entire line from the file , headers as well > > >as just the desired body messages . > > > > > >fp = file("/home/chuck/pythonScript/testbox") > > >mb = mailbox.UnixMailbox(fp, > > >email.message_from_file)
1
4011
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the live databases on the network. Is there a way, via code, when I get back in-house from being on the road to click a button, and select the backends I want to link to? I would want to delete all the current links and link to the "live"
1
1333
by: Big E | last post by:
I'm using ASP.Net. I have a Repeater that uses a stored procedure to list stuff and have a hyperlink that allows users to click and go to another page. I also have a drop down list on the form. I would like users to be able to select from the drop down list and have that selection filter the dataset. I don't want to use a parameter in the stored procedure from the drop down list because on load I don't want a filter. Any ideas?
13
5261
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data structures? Thanks for any hints, Leszek Taratuta
10
10208
by: Mike9900 | last post by:
Hello, I need a regular expression to match a currency with its symbol, for example Pound66.99 must return 66.99 or Pound(66.99) or Pound-66.99 or -66.99Pound return -66.99 or any other combination return the decimal number. I have created a regular expression, but it seems that it does not work if the number is Pound66.99 but it works if the sign is after the number: public static Decimal ConvertToDecimal(String str)
5
2323
by: Avi Kak | last post by:
Folks, Does regular expression processing in Python allow for executable code to be embedded inside a regular expression? For example, in Perl the following two statements $regex = qr/hello(?{print "saw hello\n"})mello(?{print "saw mello\n"})/; "jellohellomello" =~ /$regex/;
2
2286
by: CodeMonkey775 | last post by:
I'm having problems passing a variable to a method which is executed and compiled using CodeDom. The situation is I have a List<CellData> with cells, each containing a formula (like Excel). I am trying to pass this list to an executable section of code which is compiled during run-time. The formulas are calculated in CodeDom and the result is returned on the same List<CellData> object I passed. The user-defined class which holds the cell data...
28
1859
by: Joey Martin | last post by:
One of my servers got hacked with the SQL injection due to poor coding. So, I had someone write a stored procedure and new code. But, to me, it looks just as flawed, even using the stored procedure. email=request("email") password=request("pw") OLD CODE: sql="select * from tablename where email='" & email & "' and password='"
11
2937
by: JRough | last post by:
I'm trying to use output buffering to cheat so i can print to excel which is called later than this header(). header("Content-type: application/xmsdownload"); header("Content-Disposition: attachment; header("Pragma: no-cache"); header("Expires; 0"); print "$header\n$data";
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10231
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.