Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi,
 
I failed to convert following 2 type of data into readable record by using following code. This data migrated from lotus note to sql server by using LEI.
Anyone know how?
 
in image data type:
0x82FF520001000000000000000000AF05002DAF0500000000000000000000000000000000000000000000000000000000000000000000000000000000000086010000000054040F0000000F000000000000008304010085FF08000500000881028304010085FF3B000500000820202020202020202020202020202020202020
 
in binary data type:
0x82FF520002000000000001000000AF052337AF0500000000000000000000000000000000000000000000000000000000000000000000000000000000000086010000000054040F0000000F000000000000008304020085FF08000600000900000000000000000000000000000000000000000000000000000000000000000000
 
string sqlText = "..."
 SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ToString());
        SqlCommand command = new SqlCommand(sqlText, connection);
 
        //open the database and get a datareader
        connection.Open();
        SqlDataReader dr = command.ExecuteReader();
        if ( dr.Read()) //yup we found our image
        {
const int CHUNK_SIZE = 2 * 1024;
       byte[] buffer = new byte[CHUNK_SIZE];
       long bytesRead;
       long fieldOffset = 0;
       using (var stream = new MemoryStream())
       {
           while ((bytesRead = dr.GetBytes(dr.GetOrdinal("checklist"), fieldOffset, buffer, 0, buffer.Length)) > 0)
           // while ((bytesRead = dr.GetBytes(dr.GetOrdinal("CCList"), fieldOffset, buffer, 0, buffer.Length)) > 0)
           {
               stream.Write(buffer, 0, (int)bytesRead);
               fieldOffset += bytesRead;
           }
           Response.BinaryWrite(stream.ToArray());
 

       }
Posted 1-Jan-13 21:29pm
Edited 1-Jan-13 21:31pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

what exactly do you want to do?
I think you want to save a image to a database and then retrieve it?
 
import: load your image, then convert it to a byte-array and then you can add it into your db..
orm you can convert the byte array into a base64-string?
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I would like to convert the above data to readable text. Those data already in my database.
Above code did not work. Please help!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 604
1 thatraja 370
2 OriginalGriff 319
3 Sergey Alexandrovich Kryukov 241
4 Gihan Liyanage 194
0 OriginalGriff 737
1 Dnyaneshwar@Pune 604
2 Kornfeld Eliyahu Peter 505
3 Sergey Alexandrovich Kryukov 372
4 thatraja 370


Advertise | Privacy | Mobile
Web02 | 2.8.140902.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100