473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DataTable or Array

twq
Hello

I would like to populate a 2-dimensional array with different
datatyps , 1. dimension is always a String, 2. dimension could be of
Typ Double or String.

What would be the better solution performance wise, to create an
String Array and then try to Convert the 2. Dimension into either
double or String, or to create an Datatable with Double & String
Columns, or is there any other way to do it?

Thank you in advance

Feb 13 '07 #1
5 4901
Hi,

Forget the performance or you should be interested in parts of picoseconds.

Take that which fits you the best and is the best maintanable afterwards.

Mostly I take direct a datatable, because with that I get a lot of extra
methods which I don't have at the array.

But feel free to do it in another way as you are more used with arrays.

Cor

<tw*@hispeed.chschreef in bericht
news:11**********************@a34g2000cwb.googlegr oups.com...
Hello

I would like to populate a 2-dimensional array with different
datatyps , 1. dimension is always a String, 2. dimension could be of
Typ Double or String.

What would be the better solution performance wise, to create an
String Array and then try to Convert the 2. Dimension into either
double or String, or to create an Datatable with Double & String
Columns, or is there any other way to do it?

Thank you in advance

Feb 13 '07 #2
twq
thank you very much for your quick response,

Best regards
Tobias

Feb 13 '07 #3
twq
Follow up question,

How would you implement a Datatable as a Property of Class where the
Table would have 5 specified columns?

thanks

Feb 13 '07 #4

<tw*@hispeed.chwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
Follow up question,

How would you implement a Datatable as a Property of Class where the
Table would have 5 specified columns?

thanks
You can just add it as a property, and then create it and/or populate it in
your constructor. Here's an example.
Public Class Car

Private _ColorTable As DataTable
Property ColorTable() As DataTable
Get
Return _ColorTable
End Get
Set(byVal value As ColorTable)
_ColorTable = value
End Set
End Property

Public Sub New()
CreateColorTable()
End Sub

Private Sub CreateColorTable()
'This creates a new datatable. You could just as
' easily read it in from a data source.
' I wasn't sure which method you were using.
Dim ct as New DataTable()
ct.Columns.Add("Red", GetType(Integer))
ct.Columns.Add("Blue", GetType(Integer))
ct.Columns.Add("Green", GetType(Integer))
ct.Columns.Add("Hue", GetType(Integer))
ct.Columns.Add("ColorName", GetType(String))
ColorTable = ct
End Sub

End Class
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
Feb 13 '07 #5
use an array

ADO.net is about ready for another 'Visual Fred' moment and you don't
want to have to rewrite everything every 2 years

On Feb 13, 2:19 am, "t...@hispeed.ch" <t...@hispeed.chwrote:
Hello

I would like to populate a 2-dimensional array with different
datatyps , 1. dimension is always a String, 2. dimension could be of
Typ Double or String.

What would be the better solution performance wise, to create an
String Array and then try to Convert the 2. Dimension into either
double or String, or to create an Datatable with Double & String
Columns, or is there any other way to do it?

Thank you in advance

Feb 14 '07 #6

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

Similar topics

0
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
4
by: Haydnw | last post by:
Hi, I'd like to put a load of database results (several rows for 5 fields) into a two-dimensional array. Now, this may be a really stupid question, but can someone give me a pointer for how to...
5
by: Geoff Jones | last post by:
Hi Suppose we have an array of DataRows e.g. Dim drMyRows() As DataRow = myTable.Rows(0).GetChildRows("PricesCompany") generated via a relationship. The question I have is this. Isn't...
1
by: elziko | last post by:
My intention is to store an array of singles inside a DataTable so that it can me peristed somehow, maybe XML file, maybe Access/SQL Server I don't know yet so I'm just saving it as an XML file for...
14
by: Peter | last post by:
Is there a fast way to move data from DataTable into double array, or do I have to spin through every record and column? I have five tables and I need to merge these tables column wise, each table...
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
6
by: Paulers | last post by:
Hello, I have a string that I am trying to add each char to a datatable row. for example if I have a string that looks like "abcdefg", I would like to break it up into an array of characters...
2
by: =?Utf-8?B?ZGJhMTIz?= | last post by:
Note, I'm using C# I am wondering what type of control I should use for iterating through the set of records returned by callin this method below, so that I can then do some stuff with each...
0
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
2
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.