title: How to display data from a SQLite database into a GTK# TreeView?
body: <p>OS: openSuse 11.4
  IDE: MonoDevelop 2.4.2
  using GTK#</p>
  
  <p>I need to display the datatable of a sqlite database in a simple grid view, much like in WindowsForms'/WPF's datagridview, but with GTK#.
  I have been trying to configure the GTK.TreeView to display the data properly, but with no luck. The data is not displayed and I get an obscure error in the Application output. Here is my code:</p>
  
  <pre><code>            Type[] types;           
              SqliteCommand cmd = new SqliteCommand("SELECT * FROM "+Tables.USERS, _cddapConn);
              cmd.Connection.Open();
              SqliteDataReader reader = cmd.ExecuteReader();
              types = new Type[reader.FieldCount];        
  
  
          for(int i = 0; i &lt; types.Length; i++)
              types[i] = typeof(string);
          Gtk.ListStore list = new Gtk.ListStore(types);
  
          for(int i = 0; i &lt; TblUsers.SCHEMA.Length; i++)
          {               
              table.AppendColumn(TblUsers.SCHEMA[i], new Gtk.CellRendererText(), "text");
          }
  while(reader.Read())
          {
              String[] rowData = new String[TblUsers.SCHEMA.Length];
              for(int index = 0; index &lt; TblUsers.SCHEMA.Length; index++)
              {
                  rowData[index] = reader.GetString(index);                   
                  table.Columns[index].AddAttribute(new Gtk.CellRendererText(), "text", index);
  
                  }
                  list.AppendValues(rowData);
  
  
          }
          table.Model = list;
          reader.Close();
          cmd.Connection.Close();
  </code></pre>
  
  <p>I followed the example given here: <a href="http://www.mono-project.com/GtkSharp_TreeView_Tutorial" rel="nofollow">http://www.mono-project.com/GtkSharp_TreeView_Tutorial</a>.
  First I create the model (ListStore) by initializing it with the string type for the data of every column. Then I append the columns of the data table to the tree view. Then I engage the sqlite reader, and for every entry I add its data to the model. Then I add a cell for each column pointing to the data. Finally, I give the tree view its model.</p>
  
  <p>However, this only manages to display the columns with no data. What I get in the application output is this:</p>
  
  <pre><code>Gtk-CRITICAL **: gtk_tree_view_column_cell_layout_add_attribute: assertion `info != NULL' failed
  </code></pre>
  
  <p>I spent a few hours looking for any information about this problem with no success. What is surprising is that I found no examples of the treeview being used in mono to display data from a database, or any documentation on gtk# for that matter.</p>
  
  <p>How can I make my grid view work? I really only need it to display the data and accept row selections (so that I can check the ID column of the selected row). </p>