asp.net 水晶报表 显示 需要查找的行
asp.net 水晶报表 显示 需要查找的行 --------------------编程问答-------------------- 数据库连接类,需要在webconfig中设置好AppSettings["servername"],AppSettings["userid"],AppSettings["pass"]这三个数据库OLEDB的连接字符串.public class LoginCrystalReport
{
public void Login(CrystalDecisions.CrystalReports.Engine.ReportDocument report)
{
string servername, username, password;
// t Database Logon to main report
servername = System.Configuration.ConfigurationSettings.AppSettings["servername"];
username = System.Configuration.ConfigurationSettings.AppSettings["userid"];
password = System.Configuration.ConfigurationSettings.AppSettings["pass"];
foreach (CrystalDecisions.Shared.IConnectionInfo connection in report.DataSourceConnections)
{
if (connection.ServerName == servername)
{
connection.SetLogon(username, password);
}
}
// t Database Logon to subreport
foreach (CrystalDecisions.CrystalReports.Engine.ReportDocument subreport in report.Subreports)
{
foreach (CrystalDecisions.Shared.IConnectionInfo connection in subreport.DataSourceConnections)
{
if (connection.ServerName == servername)
{
connection.SetLogon(username, password);
}
}
}
}
}
然后新建一个crystalreport1.rpt.使用数据库专家连接OLEDB上的你建立的数据库.
最后在default.aspx中拖入crytalreportview控件再在pageload事件中写入
DataSet ds = new DataSet();
LoginCrystalReport Logins = new LoginCrystalReport();
ads.Fill(ds, "TEST");//最狗易做图的地方,这个Tablename一定要与你的数据库专家建的表名一样.
CrystalReport1 oRpt = new CrystalReport1();
oRpt.SetDataSource(ds);
Logins.Login(oRpt);
CrystalReportViewer1.ReportSource = oRpt;
CrystalReportViewer1.DataBind();
就可以读相应的sql语句选出来的dataset了.
--------------------编程问答-------------------- 楼主的意思,我咋没看懂?
显示 需要查找的行
1、数据库的SQL语句进行过滤?
2、使用水晶报表的查找功能?
3、???
补充:.NET技术 , ASP.NET