Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 29, 2013 07:13 PM by kartmcad
0 Points
5 Posts
Jan 29, 2013 07:13 PM|LINK
Hi,
I need to convert a value coming from DB via ExecuteReader (which is a SqlDBType.Binary) to String.
Since, I am trying to save that value in a HashTable.
But everytime, I am getting System.Byte stored in the HashTable.
Here is the value I am getting from DB "0000000000000000000000000A010101"
I have tried the following ways but still not working.
Try 1
byte val = Convert.ToByte(reader.GetValue(1));
Try 2
byte[] binaryData = reader[1]; string text = Encoding.UTF8.GetString(binaryData)
Please help me in resolving the issue.
Thanks,
Karthik KK
kartmcad
0 Points
5 Posts
Need to convert System.Byte[] from ExecuteReader to String
Jan 29, 2013 07:13 PM|LINK
Hi,
I need to convert a value coming from DB via ExecuteReader (which is a SqlDBType.Binary) to String.
Since, I am trying to save that value in a HashTable.
But everytime, I am getting System.Byte stored in the HashTable.
Here is the value I am getting from DB "0000000000000000000000000A010101"
I have tried the following ways but still not working.
Try 1
Try 2
Please help me in resolving the issue.
Thanks,
Karthik KK