vs2005中使用如何reportView控件?
请问在VS2005中用reportView控件,采用编程方式应该如何实现?大家有没有例子提供一下!我找了好久都没找到!
谢谢!
------解决方案--------------------给楼一个简单例子
在一个窗体中加一个CrystalReportViewer
然后在后台执行:
string connStr =ConfigurationSettings.AppSettings[ "ConnString1 "].ToString();
SqlDataSource datasource = new SqlDataSource(connStr, 你的SQL语句);
ReportDocument doc = new ReportDocument();
TableLogOnInfo logininfo = new TableLogOnInfo();
string path;
path = Server.MapPath( "report1.rpt ");
doc.Load(path);
string a, b, c, d;
a = System.Configuration.ConfigurationManager.AppSettings[0];
b = System.Configuration.ConfigurationManager.AppSettings[1];
c = System.Configuration.ConfigurationManager.AppSettings[2];
d = System.Configuration.ConfigurationManager.AppSettings[3];
logininfo.ConnectionInfo.ServerName = a;
logininfo.ConnectionInfo.DatabaseName = b;
logininfo.ConnectionInfo.UserID = c;
logininfo.ConnectionInfo.Password = d;
doc.Database.Tables[0].ApplyLogOnInfo(logininfo);
doc.Database.Tables[0].SetDataSource(datasource.Select(DataSourceSelectArguments.Empty));
CrystalReportViewer1.ReportSource = doc;
------解决方案--------------------up
------解决方案--------------------就是.是reportViewer控件.!@