Solved

using a byte array type in a dataset

Posted on 2010-08-24
5
660 Views
Last Modified: 2013-12-17
hi -- i'm using vs 2010 and c#. i have a byte array i want to store in a data column in a table. i'm looking for how to format and program this data type. I also want to save and retrielve the data set to an xml file. i have everything working except for the byte array (i just started working with it, before i stored the array as a string and converted back and forth.) i didn't see any example code in the ms help. i also would like to know how the xml value is stored -- space deliminted, comma delimented, etc between array values.
thanks,
Jim
0
Comment
Question by:jdcoburn
  • 3
5 Comments
 

Author Comment

by:jdcoburn
ID: 33514314
i should add that i'm getting "invalid length for Base 64 char array when i try and read in the xml field containing a set of numbers (the size of the data in the xml field is less than 20 bytes.)
0
 
LVL 6

Accepted Solution

by:
nipunu earned 500 total points
ID: 33520129
Check following articles.

 Read / Write BLOBs from / to SQL Server using C# .NET DataReader   - http://www.akadia.com/services/dotnet_read_write_blob.html

Storing and Retrieving Images from SQL Server using Microsoft .NET - http://www.experts-exchange.com/Programming/Languages/.NET/Visual_CSharp/Q_26425451.html

In Sql Server, use can image data type or varbinary data type, to store byte array data.
0
 

Author Comment

by:jdcoburn
ID: 33527226
ok - thanks. i've gotten this far and realized that the byte[] is serialized using  base64 char encoding and it would be more convenient to have it as hexBinary. i'm reading and writing data from a dataset using the dataset designer. the type i've selected for a field in a table is byte[].  i'm using the ds.xmlRead() and ds.xmlWrite() to serialize to and from an xml file using the xml schema generated by the dataset designer. there doesn't seem to be an obvious place to change the serialization method for byte[] field. any suggestions?
0
 

Author Closing Comment

by:jdcoburn
ID: 34846071
it works.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now