store rtf data into sql database RRS feed

  • Question

  • Hello, how can I retrieve the character codes when datatype is varbinary. It only gave the "System.Byte[]" string. Here is my code:

            public String getTextText(string name)
                DataTable myData = new DataTable();
                SQLiteCommand cmd;
                SQLiteDataAdapter adptr = new SQLiteDataAdapter(); ;
                SQLiteConnection con = new SQLiteConnection("Data Source=database.db;Version=3;New=False;Compress=True;");
                cmd = con.CreateCommand();
                string sql = "SELECT * FROM parent where name ='" + name + "' ";
                cmd.CommandText = sql;
                adptr.SelectCommand = cmd;
                return myData.Rows[0][1].ToString();

    • Moved by Bob Beauchemin Thursday, May 9, 2013 10:02 PM Moved to a more appropriate forum
    Thursday, May 9, 2013 5:25 PM

All replies

  • could anyone revise my code? I want to retrieve the characters exactly stored on the database. It gave me the string "System.Byte[]" when using data.rows[0][1].ToString(). I want to get the rtf character codes, I used varchar  and text type before but it gave the the exact words but I want the rtf character codes. Could anyone help me? Thanks in advance.
    Friday, May 10, 2013 4:23 AM
  • You might want to take a look at the code in the below link:


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, May 10, 2013 4:30 PM
  • it does not work on me
    Monday, May 20, 2013 1:59 PM