Click here to Skip to main content
15,792,380 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I made a report in CR 2013 using a Sql database. I added the report to my web project. I added a new web form and then added a crystalreportviewer to the web form. I then added the report to the crystalreportviewer. The report shows with data from the database. My question is, Do I need a dataset or just use the Sql database? What I am trying to do is build the report for different users. Each user has a session when they login. The report should only show that users data on the report.

1 solution

Share this answer
Computer Wiz99 14-Feb-14 11:12am    
Sampath Lokuge, Thanks for the links and info. I did follow them and still having problems. When I logon as a different user, the report is not populating with the current users data from the database. Why is that? What did I do wrong?
Sampath Lokuge 14-Feb-14 11:46am    
How to retrieve the data from the db ? Can you put that query here ?
Computer Wiz99 14-Feb-14 11:56am    
Well, this is what I have. I made a report in CR 2013. I added it to the web project. I added a new web form then added crystalreportviewer. Then I added the report to the crystalreportviewer. All of the data from the SQL database shows for the report but does not change when a different user logs in. I am trying to display the current user data when they click on the print button. When the user clicks on the print button it should show the report in a preview window with the current users data. But it only shows the first record in the database. How can I have the report to populate with the right data from the database with the current user? I do have a session in place also.
Sampath Lokuge 14-Feb-14 14:11pm    
Ok,What's your db SQL query for that ?
Computer Wiz99 14-Feb-14 14:34pm    
This is what I have after I put the data fields on the report.

SELECT "Table1"."LongName", "Table1"."CITY", "Table1"."STATE", "Table2"."Total_Reve", "Table2"."Instructio", "Table2"."Research", "Table2"."Public_Ser", "Table2"."Academic_S", "Table2"."Student_Se", "Table2"."Institutio", "Table2"."Physical_P", "Table2"."Scholarshi", "Table2"."Auxiliary_", "Table2"."Hospitals", "Table2"."Independen", "Table2"."OtherExp", "Table2"."TotAssets", "Table2"."TotLiability", "Table2"."NonExppermresAssets", "Table2"."EXPENDABLE", "Table2"."UnrnetAssets", "Table2"."TotalRev", "Table2"."TuitFees", "Table2"."CurrDebt", "Table2"."LongTermDebt", "Table1"."INST_ID", "Table2"."INST_ID"
FROM "Password"."dbo"."Table1" "Table1" INNER JOIN "Password"."dbo"."Table2" "Table2" ON "Table1"."INST_ID"="Table22"."INST_ID"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900