georgeb3
asked on
Crystal Reports deployment issue/report works on my machine but no one elses
Hello,
Here's the situation...we have a windows app that's been up and running for a while. I just created a new CR report and tested it on my development machine and it works great.
In the past, whenever we make changes to the app we just recompile the app and distribute the new .exe via logon scripts to all of our staff. This seems to work well...but for some reason when we distributed the new exe with the new CR report the report wouldn't work.
Would this have something to do with just copying the .exe not having the new CR report compiled into it? When I look into the install directories of the app, none of the other, older CR reports are listed as separate .rpt files...shouldn't the new report be rolled into the .exe just like the older ones?
Do I need to create a new deployment project and roll the change out that way? Is that the only way a new CR report will successfully be distributed?
Points:
- app has pre-existing CR reports that work
- new CR report works great on development machine (regardless of logon credentials)
- CR report won't work on any other machine (even for my logon credentials)
- CR.net
- VS.2003
Any help would be appreciated. I really don't want to have to create a new deployment project since the setup is fairly complex...I just want to roll out a new CR report.
Thanks.
Here's the situation...we have a windows app that's been up and running for a while. I just created a new CR report and tested it on my development machine and it works great.
In the past, whenever we make changes to the app we just recompile the app and distribute the new .exe via logon scripts to all of our staff. This seems to work well...but for some reason when we distributed the new exe with the new CR report the report wouldn't work.
Would this have something to do with just copying the .exe not having the new CR report compiled into it? When I look into the install directories of the app, none of the other, older CR reports are listed as separate .rpt files...shouldn't the new report be rolled into the .exe just like the older ones?
Do I need to create a new deployment project and roll the change out that way? Is that the only way a new CR report will successfully be distributed?
Points:
- app has pre-existing CR reports that work
- new CR report works great on development machine (regardless of logon credentials)
- CR report won't work on any other machine (even for my logon credentials)
- CR.net
- VS.2003
Any help would be appreciated. I really don't want to have to create a new deployment project since the setup is fairly complex...I just want to roll out a new CR report.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just saw your recent post of the error message. That can be caused by a firewall blocking access to the server in question, or the datasource used in the database expert on your PC is not setup on the client PCs, or the user information doesn't work to login to the datasource,
But you said you tried your login information, so it shouldn't be the latter issue.
But you said you tried your login information, so it shouldn't be the latter issue.
ASKER
Vaxman2....I think you may have stumbled onto something with your first post. I did reference it as Rpt.OpenSubReport("reportn ame.rpt") and I did NOT distribute the rpt file.
So would the rpt file go in teh same directory as the apps exe file?
So would the rpt file go in teh same directory as the apps exe file?
ASKER
Vaxman2, in response to your database suggestions...
I'm using the same connection string that is used throughout the app...so if there was a problem with the data connection or accessing the DB then an error would be thrown earlier (on the logon page).
The error only occurs when trying to open the report.
I'm attaching the vb code below...I made a main report and one sub report. Like I said, it works perfectly for me on my machine...so I know the CR reports are linked to properly.
The logon credentials are in the connection string, so I know it's not a DB permissions issue either.
I'm wondering if it has something t o do with the XSD files I used when setting up the reports...I'm not deploying them either...I wonder if they need to be copied too.
I'm using the same connection string that is used throughout the app...so if there was a problem with the data connection or accessing the DB then an error would be thrown earlier (on the logon page).
The error only occurs when trying to open the report.
I'm attaching the vb code below...I made a main report and one sub report. Like I said, it works perfectly for me on my machine...so I know the CR reports are linked to properly.
The logon credentials are in the connection string, so I know it's not a DB permissions issue either.
I'm wondering if it has something t o do with the XSD files I used when setting up the reports...I'm not deploying them either...I wonder if they need to be copied too.
Dim con As New SqlClient.SqlConnection(PConString)
Dim qry As New System.Text.StringBuilder("MAIN REPORT QUERY GOES HERE")
Dim qry2 As New System.Text.StringBuilder(SUBREPORT QUERY GOES HERE)
Dim ADP As New SqlClient.SqlDataAdapter(qry.ToString, con)
Dim DSx As New xsdStandardCageV2Schema2
ADP.Fill(DSx, "ReportData")
Dim ADP2 As New SqlClient.SqlDataAdapter(qry2.ToString, con)
Dim DSy As New xsdLabelsV2
ADP2.Fill(DSy, "xsdLabelsV2")
Dim Rpt As New rptStandardCageV2
Dim RptSub As New ReportDocument
RptSub = Rpt.OpenSubreport("rptLabelsV2.rpt")
Rpt.SetDataSource(DSx)
RptSub.SetDataSource(DSy)
CRViewer.ReportSource = Rpt
'IN DEBUG MODE, I GET ALL THE WAY TO THIS POINT WITH NO ERRORS
'BOTH DATASETS HAVE DATA - NO LOGON ISSUES
ASKER
I tried to copy the rpt files over to the same directory as the exe and the app still asks for DB logon info. Neither does copying over the xsd files to the deployed exe folder.
The weird thing is that these reports don't connect to a DB...why would CR ask for DB credentials?
The weird thing is that these reports don't connect to a DB...why would CR ask for DB credentials?
You may need to set the login information for the sub-report even though it is not a database..
Look at the accepted solution at https://www.experts-exchange.com/questions/21059125/Crystal-Rerports-in-VB-net-requesting-login-data-to-server-when-Dataset-is-the-report-source.html
Look at the accepted solution at https://www.experts-exchange.com/questions/21059125/Crystal-Rerports-in-VB-net-requesting-login-data-to-server-when-Dataset-is-the-report-source.html
ASKER
Man, I really hope not - that kind of negates the flexibility of using a single DB connection string. According to Bischoff's book, push type reports don't cache login info since you don't ever set the login info like you do for pull type reports.
I'll give it a try and see if it makes a difference...thanks for the idea.
I'll give it a try and see if it makes a difference...thanks for the idea.
ASKER
OK, so I figured it out.
The issue was that the name of the table in the xsd file and the name of the table in the dataset needed to be the same. Also, I was only passing the dataset into the report's datasource...whereas I needed to specifically pass in the datatable into the report's data source. I've attached the revised code which works properly...
The issue was that the name of the table in the xsd file and the name of the table in the dataset needed to be the same. Also, I was only passing the dataset into the report's datasource...whereas I needed to specifically pass in the datatable into the report's data source. I've attached the revised code which works properly...
Dim con As New SqlClient.SqlConnection(PConString)
Dim qry As New System.Text.StringBuilder("")
qry.Append("SELECT STATEMENT GOES HERE")
Dim qry2 As New System.Text.StringBuilder("")
qry2.Append("SUB REPORT SELECT STATEMENT GOES HERE")
'FILL MAIN REPORT'S DATASET
Dim ADP As New SqlClient.SqlDataAdapter(qry.ToString, con)
Dim DSx As New DataSet
ADP.Fill(DSx, "ReportData") 'THIS TABLE SHOULD HAVE SAME NAME
'AS THE TABLE IN THE XSD FILE USED
'FOR THE MAIN REPORT
'FILL SUBREPORT'S DATASET
Dim ADP2 As New SqlClient.SqlDataAdapter(qry2.ToString, con)
Dim DSy As New DataSet
ADP2.Fill(DSy, "xsdLabelsV2") 'THIS TABLE SHOULD HAVE SAME
'NAME AS THE TABLE IN THE XSD
'FILE USED FOR THE SUB REPORT
'INSTANTIATE THE MAIN REPORT AS THE REPORT ITSELF
Dim Rpt As New rptStandardCageV2
'INSTATNTIATE THE SUBREPORT AS A GENERIC REPORTDOCUMENT
Dim RptSub As New ReportDocument
'GET A HANDLE ON THE SUB REPORT VIA THE MAIN
'REPORT.OPENSUBREPORT METHOD
RptSub = Rpt.OpenSubreport("rptLabelsV2")
'SET THE DATASOURCES...MAKE SURE TO USE THE SAME
'DS.TABLE NAMES AS USED DURING THE DS FILL ABOVE
'OTHERWISE YOU'LL GET A DATABASE LOGIN ERROR
Rpt.SetDataSource(DSx.Tables("ReportData"))
RptSub.SetDataSource(DSy.Tables("xsdLabelsV2"))
'BIND TO THE CR VIEWER OBJECT
CRViewer.ReportSource = Rpt
ASKER
I guess what was happening is that the report wasn't sure which table to use in the dataset so it was throwing its database login window up...even if i logged in it would just say that the login info was incorrect. Probably because it really wasn't trying to get to a database, it just didn't know where to get the data from.
ASKER
This wasn't the solution, but I appreciate the time vaxman put into helping me out.
I glad you got it working!
ASKER