473,394 Members | 1,715 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,394 software developers and data experts.

copy 1 dimensional to 2 dimensional array with actual int values

Hi,
I have a table with 2 columns and a one dimensional string array.
I need to copy the string array to the table but I think I have to
convert my string array to a 2dimensional array first with an
incremental id inorder to add to table. any suggestions how to? thanks

DataTable dtContinent = ds.Tables.Add("Continent");
DataColumn dtContinent_ID = dtContinent.Columns.Add("ID", typeof(int));
DataColumn dtContinent_Name = dtContinent.Columns.Add("Name",
typeof(string));
\\string of names
_albumList = FileManager.GetAlbumNames(_photosPath);
\\error cos has only one col
dtContinent.Rows.Add(_albumList)

May 11 '06 #1
3 2165
After even Index number add new row to your table and so on.
No need to get 2-D array
SA

"j-in-uk" <je******@gmail.com> wrote in message
news:11*********************@j33g2000cwa.googlegro ups.com...
Hi,
I have a table with 2 columns and a one dimensional string array.
I need to copy the string array to the table but I think I have to
convert my string array to a 2dimensional array first with an
incremental id inorder to add to table. any suggestions how to? thanks

DataTable dtContinent = ds.Tables.Add("Continent");
DataColumn dtContinent_ID = dtContinent.Columns.Add("ID", typeof(int));
DataColumn dtContinent_Name = dtContinent.Columns.Add("Name",
typeof(string));
\\string of names
_albumList = FileManager.GetAlbumNames(_photosPath);
\\error cos has only one col
dtContinent.Rows.Add(_albumList)

May 12 '06 #2
Hi,

Can you give me the code for that line pls.......
thanks

May 12 '06 #3
kh
for(int albumIdx = 0; albumIdx<_albumList.Length; ++albumIdx)
dtContinent.Rows.Add(new object[] {albumIdx, _albumList[albumIdx]});

alternatively you can make dtContinent_ID and AutoIncrement column and pass
null as the first value in the item array.

kh

May 12 '06 #4

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

Similar topics

4
by: Venkat | last post by:
Hi All, I need to copy strings from a single dimensional array to a double dimensional array. Here is my program. #include <stdio.h> #include <stdlib.h>
6
by: Ruben | last post by:
I'm trying to pass an array of string to a function without knowing how many strings I have beforehand. I've defined one functions as char * insert(char table,int cols, char values); out of...
11
by: truckaxle | last post by:
I am trying to pass a slice from a larger 2-dimensional array to a function that will work on a smaller region of the array space. The code below is a distillation of what I am trying to...
4
by: rmorvay | last post by:
I have a requirement to search a multi-dimensional array for an item, then delete the item and "reset" the array so that their are no gaps in the resulting array. I have been trying to figure out...
4
by: entitledX | last post by:
Hi, I'm trying to use the HDF library to read a few HDF files that I need to process. The data in each file varies in rows, but the columns remain constant. Because of that, I had dynamically...
7
by: ashu | last post by:
look at code #include<stdio.h> int *mult(void); int main(void) { int *ptr,i; ptr=mult; for(i=0;i<6;i++) { printf("%d",*(ptr++));
22
by: spam.noam | last post by:
Hello, I discovered that I needed a small change to the Python grammar. I would like to hear what you think about it. In two lines: Currently, the expression "x" is a syntax error. I suggest...
5
by: nelly0 | last post by:
developing a program that will manipulate noise levels (measured in decibels) that is collected by car manufacturers. These noise levels are produced at seven different speeds by a maximum of six...
10
by: Alan Mosley | last post by:
I have a multi dimensional array, I want to copy, but when I do It shows 0's in the second dimension. Can I copy a multi dimensional array? if so how do i do it. Thanks
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.