public static string connectionString = "Data Source=FAROOQPC\\SQLEXPRESS; Initial Catalog=mydb; Integrated Security=True"; private SqlDataAdapter dataAdapter; private DataSet dataSet; private DataTable dataTable; // *** End ADO.NET objects *** private static string Name; private static string Cell; private static string Address; //private static string EmpId; protected void Page_Load(object sender, EventArgs e) { string commandstring = "select * from db"; // The link between the sql command and the database connection dataAdapter = new SqlDataAdapter(commandstring, connectionString); // Define insert, update, and delete sql commands to use. // BuildCommands(); // Declare and fill the in-memory dataset from the database dataSet = new DataSet(); dataSet.CaseSensitive = true; dataAdapter.Fill(dataSet, "Employee"); //CrystalReport Report = new CrystalReport(); ReportDocument Report = new ReportDocument(); mydataset ds=new mydataset(); mydataset.DataTable1DataTable t = (mydataset.DataTable1DataTable)ds.Tables[0]; dataTable = dataSet.Tables[0]; foreach (DataRow dataRow in dataTable.Rows) { // Load global strings from column values in the datarow //CustId = dataRow[""].ToString().Trim(); Name = dataRow["Name"].ToString().Trim(); Cell = dataRow["Cell"].ToString().Trim(); Address = dataRow["Address"].ToString().Trim(); t.AddDataTable1Row(Name, Cell, Address); } Report.SetDataSource(ds); //Report.Load("CrystalReport.rpt"); crystalview.ReportSource = Report; //crystalview.DataBind(); //crystalReportViewer1.ReportSource = Report; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)