title: inserting data into data set using data table in C#.net
body: <p>I'm using a dataset to show data on crystal report without using an SQL server. </p>
  
  <p>My problem is that data is not inserted into the table.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>try
  {
      DataSet2 ds1 = new DataSet2();             
      DataTable t1 = ds1.Tables.Add("report1");
      t1.Columns.Add("mtrno", Type.GetType("System.String"));
      t1.Columns.Add("pf1", Type.GetType("System.String"));
      t1.Columns.Add("pf2", Type.GetType("System.String"));
      t1.Columns.Add("pf3", Type.GetType("System.String"));
      t1.Columns.Add("pf4", Type.GetType("System.String"));
      t1.Columns.Add("pf5", Type.GetType("System.String"));
      t1.Columns.Add("pf6", Type.GetType("System.String"));
      t1.Columns.Add("pf7", Type.GetType("System.String"));
      t1.Columns.Add("rel", Type.GetType("System.String"));
  
      //t3.Columns.Add("r_no",Type.GetType("System.String"));
      //t3.Columns.Add("date", Type.GetType("System.String"));
      //t3.Columns.Add("type", Type.GetType("System.String"));
      //t3.Columns.Add("const", Type.GetType("System.String"));
      //t3.Columns.Add("volt", Type.GetType("System.String"));
      //t3.Columns.Add("class", Type.GetType("System.String"));
      //t2.Columns.Add("rel", Type.GetType("System.String"));
  
      DataRow r1;
      // DataRow r3;
  
      textBox1.Clear();
      DirectoryInfo d_info = new DirectoryInfo("D:\\");
      FileInfo[] f_info = d_info.GetFiles("*.txt");
      foreach (FileInfo fi in f_info)
      {
          string fname = @"D:\\" + Path.GetFileNameWithoutExtension(fi.Name) + ".txt";
          if (fname.Contains(listBox1.SelectedItem.ToString()))
          {
              StreamReader sread1 = new StreamReader(fname);
              string line = null;
              while ((line = sread1.ReadLine()) != null)
              {
  
                  if (line.Contains("[Report Header]|" + comboBox3.SelectedItem.ToString()))
                  {
                      line = line.Replace("[Report Header]|", "");
                      string[] r_words = line.Split('|');
  
                      line = sread1.ReadLine();
                      if (line.Contains("[Field Heading]|"))
                      {
                          string[] f_words = line.Split('|');
                          foreach (string s in f_words)
                          {
                              textBox1.Text = textBox1.Text + s;
                          }
                      }
                      textBox1.Text = textBox1.Text + Environment.NewLine;
                      for (int i = 0; i &lt; 32; i++)
                      {
                          line = sread1.ReadLine();
                          if (line.Contains("[Meter_Record]|") || line.Contains(comboBox4.SelectedItem.ToString()))
                          {
                              line=line.Replace("[Meter_Record]|","");                                        
                              string[] m_words = line.Split('|');
                              r1 = t1.NewRow();                                        
                              r1["mtrno"] = m_words[0].ToString();
                              r1["pf1"] = m_words[1].ToString();
                              r1["pf2"] = m_words[2].ToString();
                              r1["pf3"] = m_words[3].ToString();
                              r1["pf4"] = m_words[4].ToString();
                              r1["pf5"] = m_words[5].ToString();
                              r1["pf6"] = m_words[6].ToString();
                              r1["pf7"] = m_words[7].ToString();
                              r1["rel"] = "yes";
                              //for (int j = 0; j &lt; m_words.Length;j++ )
                              //{
                              //    textBox1.Text = textBox1.Text + m_words[j];
                              //}
                          }
                          //textBox1.Text = textBox1.Text + Environment.NewLine;
                      }
                  }
              }
          }
      }
  
      CrystalReport2 objRpt1 = new CrystalReport2();
      //objRpt.SetDataSource(ds.Tables["h_report"]);
      objRpt1.SetDataSource(ds1.Tables["report1"]);  
      crystalReportViewer1.ReportSource = objRpt1;
      crystalReportViewer1.Zoom(1);
      crystalReportViewer1.Refresh(); 
  }
  catch(Exception ex)
  {
      MessageBox.Show(ex.Message);
  }
  </code></pre>