471,355 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,355 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 6386
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Brad Moore | last post: by
4 posts views Thread by Kay | last post: by
17 posts views Thread by cpptutor2000 | last post: by
12 posts views Thread by Brian Henry | last post: by
20 posts views Thread by Niyazi | last post: by
10 posts views Thread by sposes | last post: by
2 posts views Thread by renu | last post: by
3 posts views Thread by mamul | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.