Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports in .NET accessing a hash table? 1

Status
Not open for further replies.

ChainsawJoe

Programmer
Dec 5, 2000
154
GB
Greetings all,

I've been asked to do something that I'm not sure is even possible - I've created Crystal Reports .net pages using SQL Server as the datasource, but now I'm expected to created Crystal Reports using a hashtable as the datasource. I can't even imagine how that would work?!

Since I have to choose the datasource when creating the report in VS.NET, how the crud can I select a hash table?!

No clue this end.

Anyone have any ideas? I've scoured the 'net and am coming up with nothing particularly useful.

Any help is muchos appreciated as always!

--------------------------------------------------
- better than toast.
Penguins - better than --------------------------------------------------
 
In Crystal Reports for .NET you can use either a straight connection to a database, OR a .NET DataSet as the data source for reports. (Unfortunately, the amount of documentation on this on the web seems very limited.)

To use a Strongly Typed DataSet (which you could load using the data in your HashTable, theoretically) as the report source, the easiest thing I've found is to use the Server Explorer to browse to a Table, view or stored procedure that returns the exact (or approximate) schema that you want the DataTable(s) in the DataSet to have. Add a new DataSet to you project and drag the view, table or sproc onto the Designer window of the new DataSet. Then you can tweak the columns, and names as you need for your particular report. The important thing is that the DataSet is part of the project that contains the Crystal Report.

Once you have figured out how to load the DataSet with data frm your Hashtable, you can select that DataSet as the source for the report data. Using the Database expert, open the "Project Data" folder, then open the "ADO.NET datasets" folder. You should then see the class name of the DataSet you created. (There is a bad bug in Crystal Reports that causes newly added DataSets not to be shown in that list if you've already created the report file and THEN try to add a new DataSet to the project. The only way I know to fix it is to restart Visual Studio.)

Anyway, you can now use the DataSet just as you would any other Database in Crystal Reports.

I hope that helps!

P.S. - one of the few online resources for help and info on CR.NET is the asp.net forum (therer si a dedicated Crystal Reports forum)
 
Cheers Dragonwell - I ended up coming to this conclusion myself eventually, but your explanation is still the best one I've found so far!

Many thanks - I'll give that a go!

--------------------------------------------------
- better than toast.
Penguins - better than --------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top