none
How to Convert Blob File into Readable text format

    Question

  • I have created a richtextbox and enter some text in bold and saved it in MySql as blob datatype. Am getting Problem while retrieving that blob file. how to convert it to Readable text?  Please Guide me...
    Wednesday, December 16, 2009 11:35 AM

Answers

  • This is not related to SSIS. Please find a more approriate forum for this question.

    Thanks,
    Bob
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, January 18, 2010 6:54 PM

All replies

  • I have created a richtextbox and enter some text in bold and saved it in MySql as blob datatype. Am getting Problem while retrieving that blob file. how to convert it to Readable text?  Please Guide me...
    What do you want to do with this blob record? Insert in another table, extract to a text file? Please provide more details.

    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/
    Wednesday, December 16, 2009 2:59 PM
  • Actually am doing a project called SONG MANAGEMENT in C# and am using MySQL as backend. In this project i have to store a whole song lyrics  in MySQl database. So i have created a field of type blob to save whole song lyrics. Also  some letters in lyrics  will be bold,italic.So i choosed richtext box to save. I dont know how to retreive the whole song from database... This is my problem.......Can u help me???? if Yes i will be happy........
    Thursday, December 17, 2009 5:50 AM
  • Actually am doing a project called SONG MANAGEMENT in C# and am using MySQL as backend. In this project i have to store a whole song lyrics  in MySQl database. So i have created a field of type blob to save whole song lyrics. Also  some letters in lyrics  will be bold,italic.So i choosed richtext box to save. I dont know how to retreive the whole song from database... This is my problem.......Can u help me???? if Yes i will be happy........
    Have you tried Export Column Transformation? You can use it to export BLOB column into a file.

    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/
    Thursday, December 17, 2009 12:48 PM
  • This will work:
    Byte[] byteBLOBData = new Byte[0];
    byteBLOBData = (Byte[])(row["DOCLIST"]);
    String s = System.Text.Encoding.UTF8.GetString(byteBLOBData);
    Regards,
    deshly.
    __________________
    RAQ Report: Free Excel-like Web-based Java reporting tool
    Sunday, December 20, 2009 4:09 AM
  • Thanks for your response.

    I worked out the coding which u had sent. But can u tell me how to assign to richtextbox.

    If i assign like this:

       richTextBox1.Rtf = s;

    I get 'File format is not valid'. an error message.

    Monday, December 21, 2009 11:47 AM
  • Coding for Converting Blob File in Readable Text format

    MySqlConnection
    con = new MySqlConnection(sConnString);

    // To save data in MySQL

    Byte[] bye = Encoding.Unicode.GetBytes(richTextBox1.Rtf);

    Byte[] Outbyt = new Byte[bye.Length];

    MySqlCommand cmd = new MySqlCommand("insert into imagedata(Img)values(?image)",

    con);

    cmd.Parameters.Add(
    new MySqlParameter("?image", bye));

    if (con.State == ConnectionState.Closed)

    con.Open();

    cmd.ExecuteNonQuery();

    con.Close();

     //To Retrieve Data from MySQL

    MySqlDataAdapter da = new MySqlDataAdapter("select * from imagedata",con);

    DataTable dt = new DataTable();

    da.Fill(dt);

    if (dt.Rows.Count > 0)

    {

    Outbyt = (
    Byte[])dt.Rows[0]["Img"];

    }

    richTextBox2.Rtf =
    Encoding.Unicode.GetString(Outbyt);Use This Code working 100%
    Tuesday, January 12, 2010 7:38 AM
  • This is not related to SSIS. Please find a more approriate forum for this question.

    Thanks,
    Bob
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, January 18, 2010 6:54 PM