Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 28th, 2006, 01:33 PM
Friend of Wrox
Join Date: Jun 2003
Location: Copenhagen N, , Denmark.
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default Convert byte[] to char[]

Hi all!

I'm having problems with the ToBase64CharArray method of the Convert class. I have a ashx page that supposed to get a pdf file from db.
My code looks like this:
// get the pdf blob and write in to the http stream
byte[] bytePdf = (byte[])dal.OpenQueryScalar("GetContractInfo", contractParam);
char[] charPdf = new char[bytePdf.Length];
Convert.ToBase64CharArray(bytePdf, 0, bytePdf.Length, charPdf, 0,Base64FormattingOptions.None);
According to MSDNhttp://msdn2.microsoft.com/en-us/library/3d0e5t57.aspx it should be right, but I keep getting an ArgumentOutOfRange exception on offsetOut. I've tried to set charPdf[1000000] (bytePdf is 97665) but I still get the same exception.

Any pointers?

 - mega
Moving to C# .NET
 - mega
Aspiring JavaScript Ninja
Reply With Quote
  #2 (permalink)  
Old December 29th, 2006, 11:29 AM
Friend of Wrox
Join Date: Jun 2003
Location: Copenhagen N, , Denmark.
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega

Doesn't matter. I've changed the BLOB to CLOB. Also I found out that a 100 byte array fields was 137 array fields when converted.. So the example on MSDN must be flawed.

 - mega
Moving to C# .NET
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
convert byte[] to hex value gunjan.sh C# 2005 4 January 24th, 2008 05:15 AM
Big challenge here! How to convert char* to char^? samiswt Visual C++ 2005 1 November 30th, 2007 09:09 PM
convert byte[] to hex wkm1925 C# 1 December 14th, 2006 09:07 PM
Convert a char to int!!!!?? vtvb C++ Programming 6 March 18th, 2006 05:51 AM
convert byte to bitmap jlzmut C# 2 December 18th, 2005 05:18 PM

All times are GMT -4. The time now is 02:27 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.