Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VS 2005 Crystal Reports SQL Server  moving to production web server from development machine

Posted on 2008-09-29
2
Medium Priority
?
229 Views
Last Modified: 2013-11-26
I have created some VS 2005  Crystal Reports on my development machine that use a SQL Server DB . I entered the connection info when I made the reports. These run fine on my development machine but the production web server's SQL server 's name is different from the one on my development machine. I need a way to design the report on my development machine then run it on other servers with different SQL Server names.  

I have attached code for what I have attempted so far. I put the appsettings in my webconfig at the end of the code snippet. The code is something I downloaded while trying to research this.

When I run it the section that reads the config file does not see anyy application settings so
  If (0 < rootWebConfig1.AppSettings.Settings.Count) is false . That's one problem.

The other is when it runs it has no effect at all on my development machine - the report seems to get connection info from the report and ignore the attached code . When it runs on the production machine I get an error that it can't find the server. I changed the webconfig on the production server to show the correct value for the SQL Server there in AppSettings but the code doesn't seem to have any effect on the report connection.

SO what I want to do is develop a Crystal Report on my development machne using VS 2005  and have it still work on the production web server using that machine's SQL Server.  This must be a really common thing to do for everyone. Can you make my code work or suggest an altogether easier way to approach this?
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Collections
Partial Class LE100_LE_100MainReport
    Inherits System.Web.UI.Page
    Public LE100 As New ReportDocument
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        ConfigureCrystalReports()
 
    End Sub
    Protected Sub ConfigureCrystalReports()
        Dim this As String
        Dim rootWebConfig1 As System.Configuration.Configuration
        rootWebConfig1 = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Nothing)
        If (0 < rootWebConfig1.AppSettings.Settings.Count) Then
            Dim customSetting As System.Configuration.KeyValueConfigurationElement
            customSetting = rootWebConfig1.AppSettings.Settings("LE100DB")
            If Not (Nothing = customSetting.Value) Then
                this = customSetting.Value
 
            End If
        End If
 
 
 
        Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
        myConnectionInfo.ServerName = this
        Dim thing As String = ""
        Select Case Session("Le100Report")
            Case "ZIP"
                thing = "le100 zip then strt param.rpt"
            Case "OFR"
                thing = "le100 officer zip street.rpt"
            Case Else
                thing = "Le100 zip then strt.rpt"
        End Select
     
        Dim rpt As String
 
        rpt = Server.MapPath(thing)
        LE100.Load(rpt)
        SetDBLogonForReport(myConnectionInfo)
        Me.CrystalReportViewer1.ReportSource = LE100
 
 
    End Sub
    Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
 
        Dim myTableLogOnInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo()
 
 
        For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
 
            myTableLogOnInfo.ConnectionInfo = myConnectionInfo
 
        Next
    End Sub
 
 
+++++++++from Webconfig below
 <location allowOverride="true">
    <appSettings>
      <add key="CrystalImageCleaner-AutoStart" value="true" />
      <add key="CrystalImageCleaner-Sleep" value="60000" />
      <add key="CrystalImageCleaner-Age" value="120000" />
   
      <add key="LE100DB" value="TOMKOVICLAP3" />
  
 
    </appSettings>
  </location>
  
</configuration>

Open in new window

0
Comment
Question by:tomkovic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 1500 total points
ID: 22599347
0
 

Author Comment

by:tomkovic
ID: 22600431
Well, I normally would not consider referring me to a 500 page document as a real answer but I did find out a much simpler way to do it in that document. The jist of it is that I let the form designer do it with smart tags. I dragged a CrystalReportViewer control then a CrystalReportSource control then a SQLDataSource control. I configured the datasource control to the correct logon connection in my webconfig file then set the CrystalReportCource  datasource to that datasource bby going into the CrystalReportSource' s properties then expanding the Report noded then clicking the elipsis which brought up the data sources collection. I added the datasource to that and specified the data table.

None of this worked until I set the crystalReportViewer  Enable Database Logon  to true in the designer.

See the document that mimcc referred to above for details
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question