Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Old 06-12-2008, 09:17 AM A Real Challenge...
Novice Talker

Posts: 5
Name: Johan
Trades: 0
Hi. I'm stuck on this one. I'm reading in an Excel Spreadsheet, and the Values of the sheet is extracted as an Object(,). Because a FOR..DataTable.Rows.add(..) loop takes too long, I want to directly Cast the Object(,) into a DataTable.
A DataTable is really just a 2-dimentional array, so this should by all means be possible.
Does anyone have a solution?
foozball3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-12-2008, 02:35 PM Re: A Real Challenge...
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
No, because it's not possible. I want to take the query string passed into my web page, and cast it to The Great Gatsby. This literary classic is, after all, just string text, so this should by all means be possible. Obviously, it's not.

A data table isn't just a 2 dim array. That's true in the sense that the implementation details are different, but more importantly for what you're trying to do, it's true in the sense that DataTable doesn't inherit from Array. You can cast everything to System.Object, because everything ultimately inherits from System.Object, but array is a type that specialized from a general object, and you can only cast an array into things that are along the same inheritance tree.

If you want to share your goal, there might be another solution. I'm big on generic dictionaries, but that's probably getting into too much detail. I'm guessing it's a large spread sheet, if it's taking too long to load a data table. I'm also guessing you're doing this early on in a request, per request. Can you cache it at the session or application level?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-13-2008, 05:14 AM Re: A Real Challenge...
Novice Talker

Posts: 5
Name: Johan
Trades: 0
Thanks.
Well, I see impossible as a new challenge. But as you explained it, this one is not worth chasing. (An excel cell should be simular to a datacell, but if the demand becomes greater I'll consider looking into that), But spending a week to save 30 seconds for importing, is not worth it.
I'll probably get by if i do some proper memory management and a couple of for loops.

The reason why i wanted to do it this way, is because i can't access the dde function of SAS through the Workspace Manager (That’s the function that instantly casts an excel spreadsheet into a dataset). But there's ways around it.

I'll post the Class when I'm done with the new mods to it.

LN, you're good as SQL? I need to create a 3D table for our SIPRO database. I know it can be done, and its the best solution in our case, but I've never read anything about multi-dimensional databases in the SQL manual (I might have missed it)? Do you have any pointers?
foozball3000 is offline
Reply With Quote
View Public Profile
 
Old 06-13-2008, 02:47 PM Re: A Real Challenge...
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Casting an Excel sheet to a DataTable, or a cell in a worksheet into a cell in a table, is as impossible as adding up 2 and 3 to get -45,000. They're conceptually more than just similar, so it seems like it should be possible. But cast has a special meaning - you can translate from one format to the other, but you can't have one of them in the computer's memory, and then start referring to that object in memory as if it was also something else. It needs to actually be copied into that new format, sort of like changing the encoding of text, or changing cluster size on a hard disc.

It sounds like you want SQL's Analysis Services? I'm better at the transactional (OLTP) side of SQL, but we have a BI analysit here, who works on a 28 dimension system. I think the numbers are inflated a bit, but I do the day to day stuff for our clients, and havne't really had a look at this.

Anyway, it sounds like you're well aware of

http://en.wikipedia.org/wiki/Dimensional_database
http://en.wikipedia.org/wiki/Star_schema

Here's a sample for Microsoft technologies

http://technet.microsoft.com/en-us/l...(SQL.100).aspx
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-17-2008, 09:31 AM Re: A Real Challenge...
Novice Talker

Posts: 5
Name: Johan
Trades: 0
Well, I did my research. It seems fairly simple and mere data cubes will do the trick. (I can always upgrade the system later on if its necessary) And if I did my research correctly, I can't create a data cube with the standard SQL Server Tools (Q.Analyser, E.Manager....). I did see something along the way about creating a OLAP data cube in C#, so I'll go track that down again.
Due to office politics, it’ll probably have to go the C# route until I can prove that data cubes are worth the investment.

Here's a very handy link to creating a data cube:
http://zeesql.wordpress.com/2008/05/...rst-data-cube/

Last edited by foozball3000; 06-17-2008 at 09:33 AM..
foozball3000 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to A Real Challenge...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15635 seconds with 12 queries