没做过报表开发以及打印的程序,现在我有个数据库,把相应数据读取出来,浏览后可以打印,应该怎么做?比如说,先读取到窗体中,然后再用打印控件打印?(听说winform有打印控件,还没用过)还是有什么其他好的办法,给点资料或链接也可以啊,谢过了!O(∩_∩)O谢谢

解决方案 »

  1.   

    水晶报表
    http://blog.csdn.net/benbenRH/archive/2008/10/08/3037067.aspx
      

  2.   

    呵呵呵,我做了个例子,不过使用VB做的,都差不多啦,你自己去看看,QQ 1033005200 可以传给你 
    哟西,小日本死啦死啦地
      

  3.   

    PULL模式
    PUSH模式楼主可通过这两篇文章先找找感觉。
      

  4.   

    可以试试先把数据库里的内容导出到datagridview,然后用printDocument打印datagridview里的内容,感觉也蛮好用的!
      

  5.   

    winform中自带打印和导出的功能,你试试就知道了!推荐你去看下 微软讲师 邵志东的水晶报表视频(很用帮助)免费下载!!! 我也是初学者!!
      

  6.   

    打印控件printDocument
     private void 打印ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                try
                {
                    printDialog1.Document = printDocument1;                if (printDialog1.ShowDialog() == DialogResult.OK)
                    {
                        printDocument1.Print();
                    }
                }
                catch 
                {
                    MessageBox.Show("未安装打印机!");
                }
                
              
            }
    将数据读到richtextbox里面
    private void Form1_Load(object sender, EventArgs e)
            {
                SqlConnection mysql = new SqlConnection();
                mysql.ConnectionString = "Data Source=localhost;Initial Catalog=xsgt;Integrated Security=True";
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = mysql;
               sqlCommand.CommandType = CommandType.Text;
                //sqlCommand.CommandText = "SELECT * FROM Major";
               sqlCommand.CommandText = "SELECT * FROM mm";
                mysql.Open();
                SqlDataReader sqlDateRreader;
                sqlDateRreader = sqlCommand.ExecuteReader();
               /* while (sqlDateRreader.Read())
                {
                    richTextBox1.Text += "  "+ sqlDateRreader["majorID"].ToString() + "\t"
                    + sqlDateRreader["majorname"].ToString() + "\r";            }*/
                while (sqlDateRreader.Read())
                {
                    richTextBox1.Text += "  " + sqlDateRreader["username"].ToString() + "\t"
                    + sqlDateRreader["code"].ToString() + "\r";            }
                Console.WriteLine(richTextBox1.Text);
                mysql.Close();
                sqlDateRreader.Close();
            }
      

  7.   

    用printDocument打印datagridview里的内容?怎么打啊,昨天试了很久没反应
      

  8.   

    将要打印的信息放到一个panel里面
    然后将panel绘成张图片
    最后打印这张图片就可以了