Results 1 to 5 of 5

Thread: Server has not yet been opened

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Location
    Mississippi
    Posts
    87

    Server has not yet been opened

    I get this error in IE 5.0 on the development machine:

    The page cannot be displayed
    etc...
    Error Type:
    Seagate Crystal Reports ActiveX Designer (0x80047288)
    Server has not yet been opened.
    /SQLReport.asp, line 49

    On other machines on the LAN I get a popup message:
    User Session has Expired

    I used the Crystal Reports file(aspxmps8) download and made the page step by step from the SimpleSQLQuery. The SQL Query I used isn't simple, but I know it works because I commented out the line where the error was comming from, used Response.Write, and pasted it in the SQL Query Designer. It worked there. Here is the code I used:

    <%@ Language=VBScript %>

    <HTML>
    <HEAD>
    <TITLE>Report</TITLE>

    <%
    reportname = "Test.rpt"
    %>

    <!--#Include File="AlwaysRequiredSteps.asp"-->

    <%
    ''Working SQL Query here.
    NewSQLQueryString = SELECT_String & CHR(10) & CHR(13) & FROM_String & CHR(10) & CHR(13) & WHERE_String
    ''Also checked the query here with Response.Write
    ''(NewSQLQueryString)

    crUserID = "sa"
    crPWord = ""
    Set crtable = Session("oRpt").Database.Tables.Item(1)
    crtable.SetLogonInfo "Server", "DataBase", Cstr(crUserID), CStr(crPWord)
    session("oRpt").SQLQueryString = CStr(NewSQLQueryString)
    Response.Write (NewSQLQueryString)
    %>

    <!--#Include File = "MoreRequiredSteps.asp"-->

    <!--#Include File = "SmartViewerActiveX.asp"-->

    I'm almost positive that it's exactly as the example in the SimpleSQLQueryString example. I've checked it over and over.
    What am I missing?

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    I think in the line

    crtable.SetLogonInfo "Server", "DataBase", Cstr(crUserID), CStr(crPWord)

    "Server" and "Database" need to be changed to the actual name of your server and database.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Location
    Mississippi
    Posts
    87
    Yea, thanks for answering Bruce. Actually they are in my code, I just didn't want to give my server name away in the forum.

    I have actually tried other Crystal logon syntaxes. I can't get anything to work. I've put the logon info of all syntaxes in all the pages that have to do with the report. AlwaysRequiredSteps, and etc. It's killin me.

    Thanks again.

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    How many tables does your report use? You should call SetLogonInfo for each table.

    Does your report use subreports? You will need to go through them as well.

    Here is a VB routine I recently wrote to set the report datasources. Note that the code is going through the testing phase but so far so good. It is written for Crystal 8.0 and SQL Server stored procedures. It might give you some ideas.

    VB Code:
    1. '******************************************************************************************************************
    2. 'Procedure: SetReportDataSources
    3.  
    4. 'Description:  '      Crystal saves the Login Information and Location as part of the report.  This procedure
    5. '      overrides the login information and location for all the report's DatabaseTables including any
    6. '      Subreports.  It assumes all tables use the same login criteria (ie all data is from the same database).
    7. '      It also assumes that all reports are created from stored procedures(System standard).
    8. '      In order to override the Location we need to parse the DatabaseTable.Location property.
    9. '      This allows us to easily support several "environments" but we need to tell the Crystal engine
    10. '      which Login information to use and which stored procedure to use.
    11.  
    12. '      For example - An application has three environments.  Production, QA and Dev.  The QA and Dev
    13. '      databases are called Pubs_Dev and Pubs_QA on server Handel.  Bob, a developer, creates a report
    14. '      using the Pubs_Dev database and a stored procedure called selAuthorsbyState.  Crystal will save the
    15. '      Location as pubs_dev.dbo.Proc(selAuthorsByState).  When a user named TestUser runs an application,
    16. '      selects the QA environment at login and then tries to print the report - the data is retrieved from the
    17. '      Pubs_Dev database(even if we tell Crystal to login to the QA database).
    18. '      By changing the Location to selAuthorsByState(ie remove Pubs_Dev.dbo.Proc) we are assured the
    19. '      data is retrieved from the QA database tables.
    20. '******************************************************************************************************************
    21. Private Sub SetReportDataSources(CrystalReport As CRPEAuto.Report, ServerName As String, DatabaseName As String, UserName As String, Password As String)
    22.     On Error GoTo ErrorHandler
    23.    
    24.     Dim lngStartPos As Long
    25.     Dim lngEndPos As Long
    26.    
    27.     Dim objSubReport As CRPEAuto.Report
    28.    
    29.     Dim objDB  As CRPEAuto.Database
    30.     Dim objTables    As CRPEAuto.DatabaseTables
    31.     Dim objTable     As CRPEAuto.DatabaseTable
    32.    
    33.     Dim objSections  As CRPEAuto.Sections
    34.     Dim objSection As CRPEAuto.Section
    35.    
    36.     Dim objReportObjects As CRPEAuto.ReportObjects
    37.     Dim objSubReports As CRPEAuto.SubreportObject
    38.     Dim lngIdx As Long
    39.    
    40.    
    41.     Set objDB = CrystalReport.Database
    42.     Set objTables = objDB.Tables
    43.        
    44.     'set the login information
    45.     For Each objTable In objTables
    46.    
    47.         lngStartPos = InStr(1, objTable.Location, "(", vbTextCompare) + 1
    48.         lngEndPos = InStr(lngStartPos, objTable.Location, ")", vbTextCompare)
    49.        
    50.         If lngEndPos = 0 Then
    51.             lngEndPos = Len(objTable.Location) + 1
    52.         End If
    53.        
    54.         lngEndPos = lngEndPos - lngStartPos
    55.        
    56.         objTable.Location = Mid$(objTable.Location, lngStartPos, lngEndPos)
    57.         objTable.SetLogOnInfo ServerName, DatabaseName, UserName, Password
    58.     Next
    59.    
    60.     'Access to the sub reports is through the Sections collection
    61.     Set objSections = CrystalReport.Sections
    62.  
    63.     For Each objSection In objSections
    64.        
    65.         Set objReportObjects = objSection.ReportObjects
    66.        
    67.         If objReportObjects.Count > 0 Then
    68.  
    69.             For lngIdx = 1 To objReportObjects.Count
    70.                 'make sure the report object is a subreport.
    71.                 If objReportObjects(lngIdx).Kind = crSubreportObject Then
    72.  
    73.                     'open the subreport and set the login information
    74.                     Set objSubReports = objReportObjects(lngIdx)
    75.                     Set objSubReport = CrystalReport.OpenSubreport(objSubReports.Name)
    76.  
    77.                     Set objDB = objSubReport.Database
    78.                     Set objTables = objDB.Tables
    79.  
    80.                     For Each objTable In objTables
    81.                        
    82.                         lngStartPos = InStr(1, objTable.Location, "(", vbTextCompare) + 1
    83.                         lngEndPos = InStr(lngStartPos, objTable.Location, ")", vbTextCompare)
    84.                        
    85.                         If lngEndPos = 0 Then
    86.                             lngEndPos = Len(objTable.Location) + 1
    87.                         End If
    88.                        
    89.                         lngEndPos = lngEndPos - lngStartPos
    90.                        
    91.                         objTable.Location = Mid$(objTable.Location, lngStartPos, lngEndPos)
    92.                         objTable.SetLogOnInfo ServerName, DatabaseName, UserName, Password
    93.                     Next
    94.                
    95.                 End If
    96.            
    97.             Next
    98.  
    99.         End If
    100.  
    101.     Next
    102.  
    103. Exit Sub
    104.  
    105. ErrorHandler:
    106.     Err.Raise Err.Number, "SetReportDataSources", Err.Source, Err.Description
    107. End Sub

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Location
    Mississippi
    Posts
    87
    I haven't tried that yet Bruce. I'll give it a shot Monday when I get back to the office. I do use 3 tables. I have tried the:


    table(1)
    table(2)
    table(3)

    and:

    for each table in cr.tables
    SetLogonInfo .......
    next

    Something like that. I can't remember exactly.

    I'll let you know Monday how it works out

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width