Crystal_Report PRoblem
-
I have a dropdownlist that contains items , each item points to the each tablename of a fixed database. I simply added a blank CrystalReport1 without adding any table, any logon informatio while creating Crystal Report. and also added CrystalReportViewer Control. private void Page_Load(object sender, System.EventArgs e) { if(dropdownlist1.Selectedvalue=="Table1") { SqlConnection con=new SqlConnection(); con.ConnectionString="Server=.;uid=sa;pwd=abc;database=db"; con.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from table1",con); DataSet ds=new DataSet(); da.Fill(ds); //ds.Tables.Add(); CrystalReport1 report2=new CrystalReport1(); //report2.SetDatabaseLogon("userid","pwd"); report2.SetDataSource(ds); //CrystalReportViewer1.DisplayGroupTree = false; CrystalReportViewer1.ReportSource =report2; CrystalReportViewer1.RefreshReport(); } else if(dropdownlist1.Selectedvalue=="Table2") { SqlConnection con=new SqlConnection(); con.ConnectionString="Server=.;uid=sa;pwd=abc;database=db"; con.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from table2",con); DataSet ds=new DataSet(); da.Fill(ds); //ds.Tables.Add(); CrystalReport1 report2=new CrystalReport1(); //report2.SetDatabaseLogon("userid","pwd"); report2.SetDataSource(ds); //CrystalReportViewer1.DisplayGroupTree = false; CrystalReportViewer1.ReportSource =report2; CrystalReportViewer1.RefreshReport(); } } and so on......... ===================================================== crystal Reprt is coming without data and columns of the table,(Ensuring the table contains data),i think the dataset is not attached , How can i attach database and dataset dynamically Please solve this.....