473,778 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert a DataRow to a StringArray

Hello,

Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?

Basically, I'm trying to get the results of a query and put them into
a listbox.

Right now it is done like this:

foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));

}

Unfortunately, the performance on this is poor when there is a lot of
data.

The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with

foreach(DataRow myDatarow in my DataTable)
{
myListBox.Items .Add(new ListViewItem (new String [] {
myDataRow["col1"].toString(),
myDataRow["col2"].toString(),
myDataRow["col3"].toString()
...
}

}

Any suggestions?
Thanks in advance
Nov 7 '08 #1
9 35851
Have you tried to virtualize the ListView? That will give you better
performance for large items.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"myotheraccount " <le*****@yahoo. comwrote in message
news:7a******** *************** ***********@u29 g2000pro.google groups.com...
Hello,

Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?

Basically, I'm trying to get the results of a query and put them into
a listbox.

Right now it is done like this:

foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));

}

Unfortunately, the performance on this is poor when there is a lot of
data.

The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with

foreach(DataRow myDatarow in my DataTable)
{
myListBox.Items .Add(new ListViewItem (new String [] {
myDataRow["col1"].toString(),
myDataRow["col2"].toString(),
myDataRow["col3"].toString()
...
}

}

Any suggestions?
Thanks in advance

Nov 7 '08 #2
foreach (DataRow row in DataTable1.Rows )
{
object[] itemArray = row.ItemArray;
string sItem1 = itemArray[0].ToString();
}

"myotheraccount " wrote:
Hello,

Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?

Basically, I'm trying to get the results of a query and put them into
a listbox.

Right now it is done like this:

foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));

}

Unfortunately, the performance on this is poor when there is a lot of
data.

The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with

foreach(DataRow myDatarow in my DataTable)
{
myListBox.Items .Add(new ListViewItem (new String [] {
myDataRow["col1"].toString(),
myDataRow["col2"].toString(),
myDataRow["col3"].toString()
...
}

}

Any suggestions?
Thanks in advance
Nov 7 '08 #3
Thanks for the suggestion. Unfortunately, I have a dynamic number of
columns. The code below only converts the first column to a string,
but I need to convert each of them to a string to load them all into
the list box, through this still forces me to loop through all of the
columns in the data row.
I'll try using a VirtualListBox.
Any more suggestions welcome.

On Nov 7, 5:18*pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
foreach (DataRow row in DataTable1.Rows )
{
* object[] itemArray = row.ItemArray;
* string sItem1 = itemArray[0].ToString();

}
"myotheraccount " wrote:
Hello,
Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?
Basically, I'm trying to get the results of a query and put them into
a listbox.
Right now it is done like this:
foreach(DataRow myDatarow in myDataTable)
{
* * String[] row = new String[myDataRow.ItemA rray.Length];
* * for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
* * {
* * * * row[x] = myDataRow[x].ToString();
* * }
* * myListBox.Items .Add(new ListViewItem(ro w));
}
Unfortunately, the performance on this is poor when there is a lot of
data.
The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with
foreach(DataRow myDatarow in my DataTable)
{
* * myListBox.Items .Add(new ListViewItem (new String [] {
* * * * myDataRow["col1"].toString(),
* * * * myDataRow["col2"].toString(),
* * * * myDataRow["col3"].toString()
* * * * ...
* * * * }
}
Any suggestions?
Thanks in advance
Nov 8 '08 #4
My apologies for not spelling it out enough: Using the code snippet below,
the object[] itemArray will contain an array of each item in your row. If the
row has N columns, there will be an N item array.

If you still want to include Columns 1 to 3, all you need to do is index
your array accordingly.

I personally get pretty fast results from this. My code parses roughly
35,000 records of string data in about 0.3 seconds.

"myotheraccount " wrote:
Thanks for the suggestion. Unfortunately, I have a dynamic number of
columns. The code below only converts the first column to a string,
but I need to convert each of them to a string to load them all into
the list box, through this still forces me to loop through all of the
columns in the data row.
I'll try using a VirtualListBox.
Any more suggestions welcome.

On Nov 7, 5:18 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
foreach (DataRow row in DataTable1.Rows )
{
object[] itemArray = row.ItemArray;
string sItem1 = itemArray[0].ToString();

}
"myotheraccount " wrote:
Hello,
Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?
Basically, I'm trying to get the results of a query and put them into
a listbox.
Right now it is done like this:
foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));
}
Unfortunately, the performance on this is poor when there is a lot of
data.
The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with
foreach(DataRow myDatarow in my DataTable)
{
myListBox.Items .Add(new ListViewItem (new String [] {
myDataRow["col1"].toString(),
myDataRow["col2"].toString(),
myDataRow["col3"].toString()
...
}
}
Any suggestions?
Thanks in advance

Nov 10 '08 #5
jp,

Thank you so much for your response. I'm a newbie to c#, so if you
could bear with me, I will really appreciate it.

What exactly do you mean by "index your array accordingly"? i.e.
Let's say my DataRow has 4 columns, what will the snippet look like
for that?
Thanks a lot.

On Nov 10, 9:09*am, jp2msft <jp2m...@discus sions.microsoft .comwrote:
My apologies for not spelling it out enough: Using the code snippet below,
the object[] itemArray will contain an array of each item in your row. Ifthe
row has N columns, there will be an N item array.

If you still want to include Columns 1 to 3, all you need to do is index
your array accordingly.

I personally get pretty fast results from this. My code parses roughly
35,000 records of string data in about 0.3 seconds.

"myotheraccount " wrote:
Thanks for the suggestion. *Unfortunately, I have a dynamic number of
columns. *The code below only converts the first column to a string,
but I need to convert each of them to a string to load them all into
the list box, through this still forces me to loop through all of the
columns in the data row.
I'll try using a VirtualListBox.
Any more suggestions welcome.
On Nov 7, 5:18 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
foreach (DataRow row in DataTable1.Rows )
{
* object[] itemArray = row.ItemArray;
* string sItem1 = itemArray[0].ToString();
}
"myotheraccount " wrote:
Hello,
Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?
Basically, I'm trying to get the results of a query and put them into
a listbox.
Right now it is done like this:
foreach(DataRow myDatarow in myDataTable)
{
* * String[] row = new String[myDataRow.ItemA rray.Length];
* * for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
* * {
* * * * row[x] = myDataRow[x].ToString();
* * }
* * myListBox.Items .Add(new ListViewItem(ro w));
}
Unfortunately, the performance on this is poor when there is a lot of
data.
The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with
foreach(DataRow myDatarow in my DataTable)
{
* * myListBox.Items .Add(new ListViewItem (new String [] {
* * * * myDataRow["col1"].toString(),
* * * * myDataRow["col2"].toString(),
* * * * myDataRow["col3"].toString()
* * * * ...
* * * * }
}
Any suggestions?
Thanks in advance
Nov 10 '08 #6
With 4 columns, you would do something like this:

foreach (DataRow row in DataTable1.Rows )
{
object[] itemArray = row.ItemArray;
// this is a "checking" step
if (itemArray.Leng th == 4) {
string sItem1 = itemArray[0].ToString();
string sItem2 = itemArray[1].ToString();
string sItem3 = itemArray[2].ToString();
string sItem4 = itemArray[3].ToString();
// or, if you wanted it in a list view:
string sLvItem = itemArray[0].ToString() + ";"
+ itemArray[1].ToString() + ";"
+ itemArray[2].ToString() + ";"
+ itemArray[3].ToString() + ";"
ListView1.Items .Add(sLvItem);
}
}

Of course, I'm not real sure what your code is trying to do, but this should
give you an idea how to access the elements in your row.

"myotheraccount " wrote:
jp,

Thank you so much for your response. I'm a newbie to c#, so if you
could bear with me, I will really appreciate it.

What exactly do you mean by "index your array accordingly"? i.e.
Let's say my DataRow has 4 columns, what will the snippet look like
for that?
Thanks a lot.

On Nov 10, 9:09 am, jp2msft <jp2m...@discus sions.microsoft .comwrote:
My apologies for not spelling it out enough: Using the code snippet below,
the object[] itemArray will contain an array of each item in your row. If the
row has N columns, there will be an N item array.

If you still want to include Columns 1 to 3, all you need to do is index
your array accordingly.

I personally get pretty fast results from this. My code parses roughly
35,000 records of string data in about 0.3 seconds.

"myotheraccount " wrote:
Thanks for the suggestion. Unfortunately, I have a dynamic number of
columns. The code below only converts the first column to a string,
but I need to convert each of them to a string to load them all into
the list box, through this still forces me to loop through all of the
columns in the data row.
I'll try using a VirtualListBox.
Any more suggestions welcome.
On Nov 7, 5:18 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
foreach (DataRow row in DataTable1.Rows )
{
object[] itemArray = row.ItemArray;
string sItem1 = itemArray[0].ToString();
}
"myotheraccount " wrote:
Hello,
Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?
Basically, I'm trying to get the results of a query and put them into
a listbox.
Right now it is done like this:
foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));
}
Unfortunately, the performance on this is poor when there is a lot of
data.
The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with
foreach(DataRow myDatarow in my DataTable)
{
myListBox.Items .Add(new ListViewItem (new String [] {
myDataRow["col1"].toString(),
myDataRow["col2"].toString(),
myDataRow["col3"].toString()
...
}
}
Any suggestions?
Thanks in advance

Nov 10 '08 #7
Is this any different that in my original example:

foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));

}

It looks like the only difference is that my way coverts the elements
of the DataRow directly, instead of copying them to an object array
first.
What I'm trying to avoid is having to convert each column
individually. I could have as many as 35 or 40 columns. Looping
through 40 columns for each of, say, 10,000 rows appears to be quite
time consuming. I wanted to know if there was a way to convert the
entire array in one shot?
Thanks

On Nov 10, 11:53*am, jp2msft <jp2m...@discus sions.microsoft .com>
wrote:
With 4 columns, you would do something like this:

foreach (DataRow row in DataTable1.Rows )
{
* object[] itemArray = row.ItemArray;
* // this is a "checking" step
* if (itemArray.Leng th == 4) {
* * string sItem1 = itemArray[0].ToString();
* * string sItem2 = itemArray[1].ToString();
* * string sItem3 = itemArray[2].ToString();
* * string sItem4 = itemArray[3].ToString();
* * // or, if you wanted it in a list view:
* * string sLvItem = itemArray[0].ToString() + ";"
* * * + itemArray[1].ToString() + ";"
* * * + itemArray[2].ToString() + ";"
* * * + itemArray[3].ToString() + ";"
* * ListView1.Items .Add(sLvItem);
* }

}

Of course, I'm not real sure what your code is trying to do, but this should
give you an idea how to access the elements in your row.

"myotheraccount " wrote:
jp,
Thank you so much for your response. *I'm a newbie to c#, so if you
could bear with me, I will really appreciate it.
What exactly do you mean by "index your array accordingly"? *i.e.
Let's say my DataRow has 4 columns, what will the snippet look like
for that?
Thanks a lot.
On Nov 10, 9:09 am, jp2msft <jp2m...@discus sions.microsoft .comwrote:
My apologies for not spelling it out enough: Using the code snippet below,
the object[] itemArray will contain an array of each item in your row.. If the
row has N columns, there will be an N item array.
If you still want to include Columns 1 to 3, all you need to do is index
your array accordingly.
I personally get pretty fast results from this. My code parses roughly
35,000 records of string data in about 0.3 seconds.
"myotheraccount " wrote:
Thanks for the suggestion. *Unfortunately, I have a dynamic number of
columns. *The code below only converts the first column to a string,
but I need to convert each of them to a string to load them all into
the list box, through this still forces me to loop through all of the
columns in the data row.
I'll try using a VirtualListBox.
Any more suggestions welcome.
On Nov 7, 5:18 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
foreach (DataRow row in DataTable1.Rows )
{
* object[] itemArray = row.ItemArray;
* string sItem1 = itemArray[0].ToString();
}
"myotheraccount " wrote:
Hello,
Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?
Basically, I'm trying to get the results of a query and put them into
a listbox.
Right now it is done like this:
foreach(DataRow myDatarow in myDataTable)
{
* * String[] row = new String[myDataRow.ItemA rray.Length];
* * for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
* * {
* * * * row[x] = myDataRow[x].ToString();
* * }
* * myListBox.Items .Add(new ListViewItem(ro w));
}
Unfortunately, the performance on this is poor when there is a lot of
data.
The number of columns in the DataTable depend on user input, soI
cannot simply replace all of that with
foreach(DataRow myDatarow in my DataTable)
{
* * myListBox.Items .Add(new ListViewItem (new String [] {
* * * * myDataRow["col1"].toString(),
* * * * myDataRow["col2"].toString(),
* * * * myDataRow["col3"].toString()
* * * * ...
* * * * }
}
Any suggestions?
Thanks in advance
Nov 10 '08 #8
Is this any different that in my original example:

foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));

}

It looks like the only difference is that my way coverts the elements
of the DataRow directly, instead of copying them to an object array
first.
What I'm trying to avoid is having to convert each column
individually. I could have as many as 35 or 40 columns. Looping
through 40 columns for each of, say, 10,000 rows appears to be quite
time consuming. I wanted to know if there was a way to convert the
entire array in one shot?
Thanks
On Nov 10, 11:53*am, jp2msft <jp2m...@discus sions.microsoft .com>
wrote:
With 4 columns, you would do something like this:

foreach (DataRow row in DataTable1.Rows )
{
* object[] itemArray = row.ItemArray;
* // this is a "checking" step
* if (itemArray.Leng th == 4) {
* * string sItem1 = itemArray[0].ToString();
* * string sItem2 = itemArray[1].ToString();
* * string sItem3 = itemArray[2].ToString();
* * string sItem4 = itemArray[3].ToString();
* * // or, if you wanted it in a list view:
* * string sLvItem = itemArray[0].ToString() + ";"
* * * + itemArray[1].ToString() + ";"
* * * + itemArray[2].ToString() + ";"
* * * + itemArray[3].ToString() + ";"
* * ListView1.Items .Add(sLvItem);
* }

}

Of course, I'm not real sure what your code is trying to do, but this should
give you an idea how to access the elements in your row.

"myotheraccount " wrote:
jp,
Thank you so much for your response. *I'm a newbie to c#, so if you
could bear with me, I will really appreciate it.
What exactly do you mean by "index your array accordingly"? *i.e.
Let's say my DataRow has 4 columns, what will the snippet look like
for that?
Thanks a lot.
On Nov 10, 9:09 am, jp2msft <jp2m...@discus sions.microsoft .comwrote:
My apologies for not spelling it out enough: Using the code snippet below,
the object[] itemArray will contain an array of each item in your row.. If the
row has N columns, there will be an N item array.
If you still want to include Columns 1 to 3, all you need to do is index
your array accordingly.
I personally get pretty fast results from this. My code parses roughly
35,000 records of string data in about 0.3 seconds.
"myotheraccount " wrote:
Thanks for the suggestion. *Unfortunately, I have a dynamic number of
columns. *The code below only converts the first column to a string,
but I need to convert each of them to a string to load them all into
the list box, through this still forces me to loop through all of the
columns in the data row.
I'll try using a VirtualListBox.
Any more suggestions welcome.
On Nov 7, 5:18 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
foreach (DataRow row in DataTable1.Rows )
{
* object[] itemArray = row.ItemArray;
* string sItem1 = itemArray[0].ToString();
}
"myotheraccount " wrote:
Hello,
Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?
Basically, I'm trying to get the results of a query and put them into
a listbox.
Right now it is done like this:
foreach(DataRow myDatarow in myDataTable)
{
* * String[] row = new String[myDataRow.ItemA rray.Length];
* * for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
* * {
* * * * row[x] = myDataRow[x].ToString();
* * }
* * myListBox.Items .Add(new ListViewItem(ro w));
}
Unfortunately, the performance on this is poor when there is a lot of
data.
The number of columns in the DataTable depend on user input, soI
cannot simply replace all of that with
foreach(DataRow myDatarow in my DataTable)
{
* * myListBox.Items .Add(new ListViewItem (new String [] {
* * * * myDataRow["col1"].toString(),
* * * * myDataRow["col2"].toString(),
* * * * myDataRow["col3"].toString()
* * * * ...
* * * * }
}
Any suggestions?
Thanks in advance
Nov 10 '08 #9
Again, I misunderstood. I thought you wanted a way to build your array faster
in fewer steps.

If you are looking to have less data to dig through, try something like this
(modified to how you need to use it, of course):

Is this any different that in my original example:

foreach(DataRow myDatarow in myDataTable.Sel ect("JobTitle=M ANAGER"))
{
myListBox.Items .Add(new ListViewItem(my Datarow["FullName"]));
}

Is this more in line with what you are looking for? Without more
information, I don't know how to help you further.

~Joe
"myotheraccount " wrote:
Is this any different that in my original example:

foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));

}

It looks like the only difference is that my way coverts the elements
of the DataRow directly, instead of copying them to an object array
first.
What I'm trying to avoid is having to convert each column
individually. I could have as many as 35 or 40 columns. Looping
through 40 columns for each of, say, 10,000 rows appears to be quite
time consuming. I wanted to know if there was a way to convert the
entire array in one shot?
Thanks
On Nov 10, 11:53 am, jp2msft <jp2m...@discus sions.microsoft .com>
wrote:
With 4 columns, you would do something like this:

foreach (DataRow row in DataTable1.Rows )
{
object[] itemArray = row.ItemArray;
// this is a "checking" step
if (itemArray.Leng th == 4) {
string sItem1 = itemArray[0].ToString();
string sItem2 = itemArray[1].ToString();
string sItem3 = itemArray[2].ToString();
string sItem4 = itemArray[3].ToString();
// or, if you wanted it in a list view:
string sLvItem = itemArray[0].ToString() + ";"
+ itemArray[1].ToString() + ";"
+ itemArray[2].ToString() + ";"
+ itemArray[3].ToString() + ";"
ListView1.Items .Add(sLvItem);
}

}

Of course, I'm not real sure what your code is trying to do, but this should
give you an idea how to access the elements in your row.

"myotheraccount " wrote:
jp,
Thank you so much for your response. I'm a newbie to c#, so if you
could bear with me, I will really appreciate it.
What exactly do you mean by "index your array accordingly"? i.e.
Let's say my DataRow has 4 columns, what will the snippet look like
for that?
Thanks a lot.
On Nov 10, 9:09 am, jp2msft <jp2m...@discus sions.microsoft .comwrote:
My apologies for not spelling it out enough: Using the code snippet below,
the object[] itemArray will contain an array of each item in your row.. If the
row has N columns, there will be an N item array.
If you still want to include Columns 1 to 3, all you need to do is index
your array accordingly.
I personally get pretty fast results from this. My code parses roughly
35,000 records of string data in about 0.3 seconds.
"myotheraccount " wrote:
Thanks for the suggestion. Unfortunately, I have a dynamic number of
columns. The code below only converts the first column to a string,
but I need to convert each of them to a string to load them all into
the list box, through this still forces me to loop through all of the
columns in the data row.
I'll try using a VirtualListBox.
Any more suggestions welcome.
On Nov 7, 5:18 pm, jp2msft <jp2m...@discus sions.microsoft .comwrote:
foreach (DataRow row in DataTable1.Rows )
{
object[] itemArray = row.ItemArray;
string sItem1 = itemArray[0].ToString();
}
"myotheraccount " wrote:
Hello,
Is there a way to convert a DataRow to a StringArray, without looping
through all of the items of the DataRow?
Basically, I'm trying to get the results of a query and put them into
a listbox.
Right now it is done like this:
foreach(DataRow myDatarow in myDataTable)
{
String[] row = new String[myDataRow.ItemA rray.Length];
for (int x = 0; x < myDataRow.ItemA rray.Length; x++)
{
row[x] = myDataRow[x].ToString();
}
myListBox.Items .Add(new ListViewItem(ro w));
}
Unfortunately, the performance on this is poor when there is a lot of
data.
The number of columns in the DataTable depend on user input, so I
cannot simply replace all of that with
foreach(DataRow myDatarow in my DataTable)
{
myListBox.Items .Add(new ListViewItem (new String [] {
myDataRow["col1"].toString(),
myDataRow["col2"].toString(),
myDataRow["col3"].toString()
...
}
}
Any suggestions?
Thanks in advance

Nov 10 '08 #10

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

Similar topics

6
452
by: roni | last post by:
i have array of objects that's are strings. i need to convert it to array of string before sending to method. is there a way to convert ? (short way..)
0
1111
by: Tonya | last post by:
I receive this error in compile time "error C2664: 'void System::Data::DataRow::set_Item(int,System::Object __gc *)' : cannot convert parameter 2 from 'System::DateTime' to 'int'" I don't know how to solve it. //lines in my program, which caused this problem are Type* TypCol =new System::Type* TypCol=Type::GetType("System.DateTime")
1
4774
by: Paul W | last post by:
How do I do this with: Option Strict On? I know of the function System.Text.ASCIIEncoding.GetChars, but that takes a Byte array not a DataRow. So with Option Strict On, how do I take the byte array in my DataRow, convert it to Text and display it on my web page without saving the info to disk inbetween? MemoryStream? Give in and set Option Strict Off? Thanks for any help,
5
2725
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried my best to convert it, but somehow the app does not work. I am also not getting any errors when I complie thus, letting me know I am on the write track. Basically what I want to do is edit,add,delete, and update an XML file in a DataGrid. Below...
2
10287
by: Paulo | last post by:
DataRow dr = (DataRow)ds.Tables.Rows.ItemArray; Error 1 Cannot convert type 'object' to 'System.Data.DataRow' C:\Documents and Settings\Fabio\Meus documentos\Visual Studio 2005\Projects\CodBarraPalm\CodBarraPalm\Default.aspx.cs 35 26 CodBarraPalm ? why this error trying to get the contents of a row on a DataSet?
2
15986
by: Chris Kennedy | last post by:
I am getting a generic list of objects from a webservice. The list is converted to an array by this process. How do I convert the array back to a list and is there any way of finding an object within the list via one it's properties. I have seen it done in C# but not VB. E.g. obj = get object from list where obj.id = 1. I could do some kind of solution using loops but I was hoping for something a little more slick. This is for .net 2.0 by...
12
1556
by: Miro | last post by:
How can I convert this part of the line: Me.dgvmyData.Columns.Item("txtCellName") ' "txtCellName" which is within this line - Me.dgvmyData.Sort(Me.dgvmyData.Columns.Item("txtCellName"), System.ComponentModel.ListSortDirection.Ascending) To read something like: Me.dgvmyData.Columns.Item( nonQuotedVariable ) So I do not have to use a "String" variable to specify the column name.
1
7160
by: John A Grandy | last post by:
To convert DataRow column values to enum types , I am using : MyEnum myEnumValue = (MyEnum )Enum.Parse( typeof( MyEnum ), ((int)row).ToString() ); Is there an easier way ?
1
2389
by: NareshN | last post by:
Hi All, I have stringarray called Timesplit with time like(17:00-2:00).How to store Timeplit array values into datetime array value.I am having 7 values that's why i am using TimeIn.I will increment arrayIndex for 7 times for 7 timeIn. I am getting error while trying to store TimesPlit to TimeIn.I want 17:00 into TimeIn and 2:00 into TimeOut.If i use datetime will get date also so please give me better options to store TimeIn and...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10068
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
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7474
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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
5370
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
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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
2863
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.