473,233 Members | 1,477 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,233 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 6712
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.