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
*/
问问题
197 次