非常感谢 阿泰 版主的回复。
我按照您的方法做了,但是我不是用的 web方式
用的 winform 方式。
我想是一样的。
但是 我做了以后 过滤出来的数据显示不出来啊。不知道是哪里出了错。
第一个 winform 上我一个 textbox 定义name 为 BianH 一个 botton 当 botton click的时候 运行
private void button1_Click(object sender, EventArgs e)
{
string BianH = this.BianH.Text;
Form ShowBianH = new ShowBianH(BianH );
ShowBianH .ShowDialog();
}
第二 个 winform 上 我添加了一个 crystalReportViewer1
代码这样写的。
public partial class ShowBianH : Form
{
public ShowBianH(string BianH)
{
string a = BianH;
InitializeComponent();
label1.Text = a;
}
private void ShowBianH_Load(object sender, EventArgs e)
{
string b = label1.Text;
DataSet1 ds1 = new DataSet1();
OleDbDataAdapter da = new OleDbDataAdapter();
string conStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e_record.mdb";//;Data Source=path; Jet OLEDB:Database Password=pwd;//
OleDbConnection con = new OleDbConnection(conStr);
da = new OleDbDataAdapter("SELECT RegName as RegName,IdType as IdType,BianH as BianH,LandNum as LandNum From AppUser", con);
da.Fill(ds1, "AppUser");
//da = new OleDbDataAdapter("select BianH as BianH,AddDate as AddDate From Land_Case where BianH=" + "'" + b + "'" + "", con);
//da.Fill(ds1, "Land_Case");
//da = new OleDbDataAdapter("select LandNum as LandNum,LandAddress as LandAddress From TLand where BianH=" + "'" + b + "'" + "", con);
//da.Fill(ds1, "TLand");
//da = new OleDbDataAdapter("select Csyj as Csyj From Shyj where BianH=" + "'" + b + "'" + "", con);
//da.Fill(ds1, "Shyj");
ReportDocument myReport = new ReportDocument();
//string reportPath = System.Web.HttpContext.Current.Server.MapPath("bin/debug/CrystalReport1.rpt");
//myReport.Load(reportPath);
myReport.SetDataSource(ds1);
crystalReportViewer1.ReportSource = myReport;
}
}
运行的时候 具体数据不显示出来。。不知道什么原因啊。?
作者: jiefy
发布时间: 2010-12-16