My report has multiple datasets, and I want to access the fields of a particular dataset from custom code. The problem is that the name of the dataset to use is only calculated during the execution of the custom code.
Allow me to illustrate:
public function Test(data as DataSets, fieldName as string)
dim datasetName as string = CalculateDatasetName()
dim ds as Dataset = data(datasetName)
' now here I want to get the fieldName out of the dataset.
' in the report, I would do something like
' First(Fields!fieldName.Value, datasetName)
' but in custom code, this obviously doesn't work.
end function
I've been looking for a way to accomplish this, but it seems you cannot get data from a dataset through custom code (there is only the commandtext property). Also it is not possible to pass the Fields collection as a parameter, as I do not know the dataset name when in the report designer.
I hope my problem description is clear.
Does anyone know how to solve this issue?
Thanks,
Phil
Hi Phil,
Look at the code below
public DataSet Dataset_name = new DataSet();
public DataTable DataTable_name = new DataTable();
public DataColumn DataColumn_name = new DataColumn();
public DataView View_name = new DataView();
public datatype function(name_of _variable_which catch_the column_value datatype)
{
DataColumn_name = new DataColumn("name_of _variable_which catch_the column_value", System.Type.GetType("System.String"))
}
Hope this helps
Priyank
No comments:
Post a Comment