logo       

Extracting a System.Byte[ ] via C#: msg#00033

Subject: Extracting a System.Byte[ ] via C#

Can someone give me a direction in researching how to convert a 
System.Byte[] data type into raw data (basically, a text string) 
using a DataReader in C#?

I'm pulling data out of a FoxPro database.  One of the tables has a 
column which is a bitmap type (holding a signature file).  I've tried 
just using 

string myText = myReader.GetValue(CurrentField);
string myText = Convert.ToBase64String(myReader.GetValue
(CurrentField))
string myText = myReader.GetValue(CurrentField).ToString();
string myText = myReader.GetString(CurrentField);

I've also tried to run it through the function

private static string ToHexString(byte[] bytes) 
{
        char[] chars = new char[bytes.Length * 2];
        for (int i = 0; i < bytes.Length; i++) 
        {
                int b = bytes[i];
                chars[i * 2] = hexDigits[b >> 4];
                chars[i * 2 + 1] = hexDigits[b & 0xF];
        }
        return new string(chars);
}

which is an example in the documentation, but can't figure out how to 
convert the CurrentField value into an array of bytes.  

I'm just lost here.  Can someone give me a link to an article that 
might help ow something?

Thanks





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dpFolB/TM
--------------------------------------------------------------------~-> 

 


<Prev in Thread] Current Thread [Next in Thread>