Hi Bill,

You actually saw the bottleneck with my code in getting data to J from MS-SQL 
server. Unfortunately, .NET doesn't support getting a column of data. Actually, 
you're question gave me pause enough to ask our top 5 C# programmers (just to 
check if I may have missed this strategy) here in the office if its possible to 
get a column of data without iterating through its corresponding rows. The 
answer was NO and it was explained to me (they sat me down in the conference 
room) in detail that the internal representation of a .NET data table is a 
list. Its basically a list of rows with the a column list of fieldnames. So its 
possible to get an array of columns from a row but not from a column without 
iterating each rows. (that was a mouthful I think)

For me, the biggest difference between ADO and ADO.NET is that they drop the 
support for the GetRows() method ( 
http://www.w3schools.com/ado/met_rs_getrows.asp ) which returns a two 
dimensional array from a recordset (data from ms-sql server). 

As an example, you can download this screen recording I've made (WARNING: file 
is around 4 MB, stored in:  
http://www.4shared.com/file/34104114/70b07a18/J_Runtime_Demo.html ) where you 
can see my C# application using J as a calculation engine. The idea here is 
that the graphical interface that you see actually has no business logic other 
than drawing the data processed and supplied by J onto the screen. Take note of 
the time it spent loading data from MS-SQL server into the J Session ... which 
is around a minute (from 6:42pm to 6:43pm in the lower right corner of the 
screen). I've compressed the time to save some disk space.

Currently, were putting in some animation like the progress bar so to make the 
loading experience for the users a bit manageable but I wish that there was 
some way to make the processing better in C# (like not looping through each and 
every record). We don’t have any problems with the data transfer speed using 
J's SetB() method from C# to J Session (I just need the support for Wide Char 
Unicode ... hint, hint. Hehehehe).

BTW, a few years back, Chris Burke actually made the exact same graphical using 
J script calling Windows GDI. It was cool and way faster ... much-much faster. 
;)

r/Alex

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bill lam
Sent: Friday, January 04, 2008 1:09 PM
To: General forum
Subject: Re: .NET datatable to J using C# (WAS: RE: [Jgeneral] 
Successfulstories)

Hello Alex,
I can see that each row is iterated, can this be avoided if data in 
sourceTable.Columns[i] be unboxed to non-object array? If it can, will it be 
possible to write eg. (I do not know the correct syntax)

jObject.SetB("SIZES_DATA0", unbox sourceTable.Columns[0])
jObject.SetB("SIZES_DATA1", unbox sourceTable.Columns[1])
..

I assume you know my usage of the word "unbox" in this context.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to