只打印一条记录 [英] Print just one record

查看:92
本文介绍了只打印一条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,抱歉这个愚蠢的问题,但这是我的问题:在我的表格上我有一个记录,我想用CR打印。
我使用VS C#和我的form.cs我试过以下但是失败(悲惨):

//选择当前记录然后打印...

int current_ANUM = Convert.ToInt32(ANUMTextBox.Text); //获取当前主键值
clienti00BindingSource.Filter =" ANUM =" + current_ANUM.ToString(); // tring过滤应该传递给CR的数据源

crystalReport11.SetDataSource(database1DataSet1);
crystalReport11.PrintToPrinter(1,false,1,1);

//删除过滤器
clienti00BindingSource.RemoveFilter();


过滤器在Form上工作得很好但CR打印总是所有记录。

如何只打印一条记录(也许使用SELECT语句?)
谢谢!

解决方案

你的意思是在sql中这样的东西吗?

选择top 1 userid来自EmployeeTable中

Hi all, sorry for this silly question but here is my issue : On my form i have a record which i want to print with CR.
I use VS C# and on my form.cs i tried the following but failed (miserably) :

           // select current record then print...
           
            int current_ANUM = Convert.ToInt32(ANUMTextBox.Text);  // getting the current Primary Key value
            clienti00BindingSource.Filter = "ANUM= " + current_ANUM.ToString() ;  // tring to filter the Datasource which should be passed to CR
           
            crystalReport11.SetDataSource(database1DataSet1 );
            crystalReport11.PrintToPrinter(1, false, 1, 1);
           
            // remove filter
            clienti00BindingSource.RemoveFilter();


filter works great on the Form but CR print always all records ..

How to print just one record (maybe using the SELECT statement ?)
Thank you !

解决方案

do you mean something like this in sql?

select top 1 userid from employeetable


这篇关于只打印一条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆