Dear NG,
I have done all I can do with Crystal Reports (CR) using the "pull" mode. I
now need to generate data in my application, load a DataSet with that data,
and "push" this on to a CR report. In the code listed below, you find a
demo DataSet, called MyDataSet, taken from the Bischof book. It runs from a
button created in Visual Studio (VS) in a project called Test3. So far it
works.
The next step is to create a .rpt file in the VS project with the layout of
the report. The Report "Expert" wants a data source. I would like to
explain to the Expert that I will supply a DataSet (MyDataSet) in my C#
program. I still want to use the Expert to format a column style report.
How do I bind the columns in the detail line of the report to the columns in
the DataSet?
Thank you,
Bob
--
Robert Schuldenfrei
S. I. Inc.
32 Ridley Road
Dedham, MA 02026
bo*@s-i-inc.com
781/329-4828
//Note: Bischof does NOT use camel notation
DataSet MyDataSet = new DataSet();
string[,] Customers = new string[,]{{"123","Jones" },{"456","Smith "}};
DataTable MyDataTable = new DataTable("Tabl eName");
DataColumn MyDataColumn;
DataRow MyDataRow;
MyDataColumn = new DataColumn(); //Column 0 w/two properties
MyDataColumn.Da taType = System.Type.Get Type("System.St ring"); //property 1
MyDataColumn.Co lumnName = "CustomerId "; //property 2
MyDataTable.Col umns.Add(MyData Column); //Load column
MyDataColumn = new DataColumn(); //Column 1 w/two properties
MyDataColumn.Da taType = System.Type.Get Type("System.St ring"); //property 1
MyDataColumn.Co lumnName = "LastName"; //property 2
MyDataTable.Col umns.Add(MyData Column); //Load column
MyDataSet.Table s.Add(MyDataTab le);
int i;
for (i=0; i<=1; i++)
{
MyDataRow = MyDataTable.New Row();
MyDataRow["CustomerId "] = Customers[i,0];
MyDataRow["LastName"] = Customers[i,1];
MyDataTable.Row s.Add(MyDataRow );
}
MessageBox.Show ("Table loaded " +
MyDataSet.Table s["TableName"].Rows[1]["LastName"].ToString());
}