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

How to convert object[] to char[] ?

Hi all,
I'm have a problem that i don't know how to convert object[] to char[]
in C# .
Does anybody know ?
Thanks.

Jan 26 '06 #1
5 6750
tienlx wrote:
I'm have a problem that i don't know how to convert object[] to char[]
in C# .
Does anybody know ?


It would help if you'd give a bit of context - what's in your object[]?
What do you want to get in your char[]? What's the overall purpose
here?

Jon

Jan 26 '06 #2
Here is my code ( i want to get result from query that have FOR XML
AUTO ):
OleDbDataReader reader= cmd.ExecuteReader();

reader.Read();
object[] arObj = new object[reader.FieldCount];
int i = reader.GetValues(arObj);
Jon Skeet [C# MVP] viết :
tienlx wrote:
I'm have a problem that i don't know how to convert object[] to char[]
in C# .
Does anybody know ?


It would help if you'd give a bit of context - what's in your object[]?
What do you want to get in your char[]? What's the overall purpose
here?

Jon


Jan 26 '06 #3
tienlx wrote:
Here is my code ( i want to get result from query that have FOR XML
AUTO ):
OleDbDataReader reader= cmd.ExecuteReader();

reader.Read();
object[] arObj = new object[reader.FieldCount];
int i = reader.GetValues(arObj);


Ah, I see. So, have you looked at what's inside arObj? What are the
values? Are they strings? I suspect they are, but I wouldn't like to
say for sure - just have a look.

Jon

Jan 26 '06 #4
OK, well at this point you now have an object array containing all the column
values of that row of the DataReader.

Are you saying you now need to convert each object in the array to type
char[]?
e.g.
char[] chAr=(char[])arObj[0];

?
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"tienlx" wrote:
Here is my code ( i want to get result from query that have FOR XML
AUTO ):
OleDbDataReader reader= cmd.ExecuteReader();

reader.Read();
object[] arObj = new object[reader.FieldCount];
int i = reader.GetValues(arObj);
Jon Skeet [C# MVP] viết :
tienlx wrote:
I'm have a problem that i don't know how to convert object[] to char[]
in C# .
Does anybody know ?


It would help if you'd give a bit of context - what's in your object[]?
What do you want to get in your char[]? What's the overall purpose
here?

Jon


Jan 26 '06 #5
I see in arObj[0],arObj[1]... is a number maybe char code. And my goal
is convert arObj to a string. Or how i can to get data from query that
have "FOR XML AUTO" ?
Thanks.

Peter Bromberg [C# MVP] viết :
OK, well at this point you now have an object array containing all the column
values of that row of the DataReader.

Are you saying you now need to convert each object in the array to type
char[]?
e.g.
char[] chAr=(char[])arObj[0];

?
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"tienlx" wrote:
Here is my code ( i want to get result from query that have FOR XML
AUTO ):
OleDbDataReader reader= cmd.ExecuteReader();

reader.Read();
object[] arObj = new object[reader.FieldCount];
int i = reader.GetValues(arObj);
Jon Skeet [C# MVP] viết :
tienlx wrote:
> I'm have a problem that i don't know how to convert object[] to char[]
> in C# .
> Does anybody know ?

It would help if you'd give a bit of context - what's in your object[]?
What do you want to get in your char[]? What's the overall purpose
here?

Jon



Jan 27 '06 #6

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

Similar topics

5
by: Brad Moore | last post by:
Hey all, I'm getting the following compiler error from my code. I was wondering if anyone could help me understand the concept behind it (I actually did try and compile this degenerate...
4
by: Kay | last post by:
how to convert int to char * ? I have found this in a web site. However, it doesn't work even I change itoa to atoi including stdlib.h char str; int i=567; str=itoa(i, str, 10);
17
by: cpptutor2000 | last post by:
Could some C guru help me please? A byte is an unsigned char in C. How do I convert from a C string to a corresponding byte array. Any help would be greatly appreciated.
12
by: Brian Henry | last post by:
first question... I have a flat file which unfortinuatly has columns seperated by nulls instead of spaces (a higher up company created it this way for us) is there anyway to do a readline with this...
12
by: GRoll35 | last post by:
I get 4 of those errors. in the same spot. I'll show my parent class, child class, and my driver. All that is suppose to happen is the user enters data and it uses parent/child class to display...
20
by: Niyazi | last post by:
Hi all, I have a integer number from 1 to 37000. And I want to create a report in excel that shows in 4 alphanumeric length. Example: I can write the cutomerID from 1 to 9999 as: 1 ---->...
10
by: sposes | last post by:
Im very much a newbie but perhaps somehone can help me. Ive been searching for a way to convert a std::string to a unsigned char* The situation is I have a function that wants a unsigned char*...
2
by: renu | last post by:
hello, I have one structure named CHAINPOINT,like CHAINPOINT { int x,y; byte dir } I am creating object of CHAINPOINT like CHAINPOINT* arrayPoint; arrayPoint = new
3
by: mamul | last post by:
Hi please some one can help me. how to convert char * to string? i have take char *argv from command line and want to pass to a function as string object(string str) i want to first convert argv...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
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
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,...

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.