Solved

using a byte array type in a dataset

Posted on 2010-08-24
5
675 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

691 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