Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to read the hexadecimal value

Author  Topic 

itissidhu
Starting Member

3 Posts

Posted - 2004-08-16 : 00:52:33
Hi,

I have a problem in reading the hexadecimal value from sql server using C#

Table Structure :
TableA
------

Column Name - DataType
-----------------------
audioFileId - Int
audioOriginalData - Image

The audio file size will be 20kb and above. So i have kept the data type for "audioOriginalData" column as image and then i dumped the audio file in the database.

Sample Data:
------------
audioFileId - audioOriginalData
------ -----------------
1 - 0x2321414D520A3C084F9C189CF86660E0E66A346
2 - 0x2321414D525A3C064F9C186CF86660E0E66A346
3 - 0x2321414D525A3C064F9C186CF86660E0E66A346

I want to generate a xml file with the id and the hexa decimal value.

Example :
<audiodetails>
<audiofileid>1</id>
<audiooriginaldata>0x2321414D520A3C084F9C189CF86660E0E66A346</audiooriginaldata>
<audiodetails>

I tried to read the database details using "SqldataReader", it says "System.Byte[]" for the "audiooriginaldata" column. Then i tried with DataSet.GetXml(), 'm not getting the hexadecimal value.

Please help.

thankx

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-08-16 : 01:01:19
???? Why?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-08-16 : 07:57:10
Well the data in the image column is datatype System.byte[] when you read it from the SqlDataReader. When you want to display the data System.byte[] does not have "readable" override of the ToString() method but just displays "System.byte[]".

To get you started:
http://support.microsoft.com/default.aspx?scid=kb;en-us;317016

/rockmoose
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-08-16 : 08:03:28
I'm still confused why you would want to display the hex value. I'm probably missing something simple here. If you want a "key" for the image or audio, then use the FileId. What are you doing with the hex? I'm probably just missing the boat here.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -