首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

vs2010 的reportview 自定义表格

2013-07-16 
vs2010 的reportview 自定义报表我用vs2010 的reportview 做报表,但是好像没有用到reportview 的datasourc

vs2010 的reportview 自定义报表
我用vs2010 的reportview 
做报表,
但是好像没有用到reportview 的datasource.
我该怎么改?
我该怎么操作?
请详细一些,谢谢。


 MySqlConnection connection = new MySqlConnection(MyConnectionString);
                MySqlCommand cmd_db = connection.CreateCommand();
                cmd_db.CommandText = "SELECT auto_id,db_domain,db_ip,db_id,db_enable, ";
                cmd_db.CommandText += " FROM_UNIXTIME(db_write_date) as db_write_date1 ";
                cmd_db.CommandText += " FROM ent_db WHERE db_contract_id =1";
                MySqlDataAdapter adap_db = new MySqlDataAdapter(cmd_db);
                DataSet ds_db = new DataSet();
                adap_db.Fill(ds_db);

                try
                {
                    reportViewer1.Visible = true;

                    ReportDataSource rds = new ReportDataSource("DataSet1_Sales_by_Year", ds_db.Tables[0]);

                    reportViewer1.LocalReport.DataSources.Clear();
                    reportViewer1.LocalReport.DataSources.Add(rds);
                    
                    this.textBox1.Text = ds_db.Tables[0].Rows[0]["db_domain"].ToString();
                    this.textBox2.Text = ds_db.Tables[0].Rows[0]["db_ip"].ToString();
                    reportViewer1.LocalReport.Refresh();



                }
                catch (Exception ex)
                {
                    String message = ex.Message;
                    MessageBox.Show(message);

                }
                finally
                {
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                }

热点排行