0
 private void button1_Click(object sender, EventArgs e)
        {

DataSet1 ds = new DataSet1();

            MySqlConnection con = new MySqlConnection();
            con.ConnectionString = "server=localhost;database=SpeedKnotting;uid=root;password=chandra";
            con.Open();

       MySqlCommand cmd = con.CreateCommand();
                cmd.CommandText = "SELECT * FROM invoice";
                myread = cmd.ExecuteReader();

              if(myread.HasRows)
                {
                    while (myread.Read())
                    {
                        String date = myread["date1"].ToString();
                        String slip_no = myread["slip_no"].ToString();
                        String loom_no = myread["loom_no"].ToString();
                        String count = myread["count"].ToString();
                        String ends = myread["ends"].ToString();
                        String knotting = myread["knotting"].ToString();
                        String transport = myread["transport"].ToString();
                        String passing =myread["passing"].ToString();
                        String total = myread["total"].ToString();


    ds.DataTable1.Rows.Add(date, slip_no, loom_no, count, ends, knotting, transport, passing, total);

                    }
                    myread.NextResult();
                }
              myread.Close();
              con.Close();



              CrystalReport1 rp = new CrystalReport1();

               rp.SetDataSource(ds);

             crystalReportViewer1.ReportSource = rp;

          crystalReportViewer1.Refresh()      

        }
/*here i get the values from DB to the above string but im not able to add to the table in dataset
*/
4

1 回答 1

0

只需更换线路

ds.DataTable1.Rows.Add(date, slip_no, loom_no, count, ends, knotting, transport, passing, total);

ds.DataTable1.Rows.Add(date1, slip_no, loom_no, count, ends, knotting, transport, passing, total);

我认为有错字。检查并告诉我。

于 2013-03-16T15:10:12.153 回答