Solved

using a byte array type in a dataset

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 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