Solved

using a byte array type in a dataset

Posted on 2010-08-24
5
657 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

13 Experts available now in Live!

Get 1:1 Help Now