Crystal Reports Ambiguous ReportDocument Variable
-
Wednesday, August 01, 2012 3:29 PM
Hi:
I am trying to declare a ReportDocument variable that keeps comming up as ambiguous. As you can see from my code below I still get the error even though I'm explicitly declairing the variable.
See the error and part of my code below.
Thanks for your help.
Error:
Compiler Error Message: BC30560: 'ReportDocument' is ambiguous in the
namespace 'CrystalDecisions.CrystalReports.Engine'.Code:
Imports System.Data Imports System.Data.SqlClient Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports CrystalDecisions.Web Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim cnSQL As New SqlConnection Dim cmdSQL As New SqlCommand Dim strConnect As String Dim da As New SqlDataAdapter Dim ds As New DataSet Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument (...Rest Of My Code) End Sub
All Replies
-
Wednesday, August 01, 2012 6:37 PM
I think it would be better to go to the sap forums for help on this but just at first glance without anymore code i would remove new keyword or check credentials. For more in-depth help try sap.com and go to the crystal reports developer forum. Sorry heres a more direct forum link:
http://scn.sap.com/community/crystal-reports
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://jefferycarlsonblog.blogspot.com/
- Edited by The Thinker Wednesday, August 01, 2012 6:43 PM
-
Wednesday, August 01, 2012 6:49 PM
If your trying to autmatically log into your crystal reports server i have some code i can dig up in vb.net but give me a little bit of time to find it.
Edit:
This is asp.net code that automatically enters credentials in vb.net but i think its very similar in a vb.net program to do but need report viewer control:
Dim rd As CrystalDecisions.CrystalReports.Engine.ReportDocument = New ReportDocument rd.Load(Server.MapPath("HighSchoolReportCard.rpt")) rd.SetDatabaseLogon("username", "password", "10.17.1.127,7771"<-server address, "active directory domain") 'rd.SetParameterValue("CalendarID", CalendarID) CrystalReportViewer1.ReportSource = rd
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://jefferycarlsonblog.blogspot.com/
- Edited by The Thinker Wednesday, August 01, 2012 6:55 PM
- Proposed As Answer by The Thinker Wednesday, August 01, 2012 6:55 PM
- Unproposed As Answer by The Thinker Thursday, August 02, 2012 5:03 PM
-
Wednesday, August 01, 2012 7:53 PM
Hey Thinker:
I'm actually not using a crystal report server but I am calling a report already added to my VS 2010 project.
The rest of my code (albeit incomplete) looks like this...
Try strConnect = ConfigurationManager.ConnectionStrings("X").ConnectionString.ToString cnSQL = New SqlConnection(strConnect) cmdSQL = New SqlCommand("SELECT * FROM view123 ORDER BY x, y", cnSQL) cmdSQL.CommandType = CommandType.Text da.SelectCommand = cmdSQL da.Fill(ds, "viewABC") rpt.SetDataSource(ds) rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, "") Catch ex As Exception Response.Write(ex.Message) End Try -
Wednesday, August 01, 2012 11:17 PM
Usually the that kind of "ambiguous namespace" error occurs when you have more than one version of the library added as references to your project. Please expand the References folder in Solution Explorer and see if you have two versions of the library there. If so choose which one is correct and remove the other. Don't forget to perform "Clean Project" under the build menu so that you remove older dlls from the bin folder. You may need to do a clean operation for the debug and release folders separately if you switch between them regularly.
EDIT: Another possibility is that your report object was created with an earlier (or later) version of CR external to your application and then was added to your project. If the two versions don't match then you would get this error. I think this can happen if you upgrade, say, from VS2005 to VS2010 and necessarily have difference CR for VS versions.
Blog: http://codemidden.wordpress.com
-
Thursday, August 02, 2012 5:05 PM
if your exporting to dynamic pdf files op remember that the newer viewer control can already export to pdf so no need to do so. Im using it in our organization (website is its real use but i also have one on a vb.net form in another project so i can open up the visual studio crystal reports add-in and put in sql code into *.rpt file for free!).
Why not load a *.rpt file as i showed above into the viewer and have it automatically export to pdf for you? (I may be mistaken but is their not a way to do this with newer version of crystal reports viewer control?)
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://jefferycarlsonblog.blogspot.com/
- Edited by The Thinker Thursday, August 02, 2012 5:10 PM
-
Thursday, August 02, 2012 7:11 PM
Hey all:
Thanks for your imput.
Dig-Boy: We're looking into a senario like you posted.
Thinker: The problem with calling the straight .rpt file is that the SELECT will have to be dynamic. (Each user that uses this report has an atribute that can change the FROM clause)
-
Tuesday, August 14, 2012 6:16 PMTurns out there there extra .dll(s) added to the project that was causing the issue.

