[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 839
  • Last Modified:

Why does the "Database Login" box keep popping up...and doesn't accept my login credentials

I'm working with a very basic app to learn about putting Crystal Reports in my applications.  I have a Windows application with a single form with a combo box, a button, and a Crystal Report Viewer on it.  I have a very simple Crystal Report that I developed using Crystal 8.5...this report accepts a single parameter. (I want to be able to develop and edit my reports outside of Visual Studio and then link to them from the application so that report changes do not require a program recompile.)

Everything was working fine until, I tried to change the database connection settings for the Crystal Report via program code. Now, when I run the program, I get a "Database Login" dialog box.  This box has the following fields on it:

Table Name: imitmidx_sql (and I can not change this table name..though it is one of the 3 tables the report uses)
Server Name: jamesdell (I can change this, though it is correct)
Database: (this is blank, so I type in 001 which is the database I want to connect to)
Login ID: sa (I can change this, though it is correct)
Password: (this is blank, but is correct for my local SQL Server)

No matter what I do, once I click the Finish button I get, "Logon Failed. Please try again."

Below is the code I'm using to load the crystal report:

Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
            'Load the report
            crReportDocument.Load("C:\Program Files\MSMPC\rpt\MSMOEINV.rpt")

            'Setup the connection information.
            crConnectionInfo = New ConnectionInfo
            With crConnectionInfo
                .ServerName = "jamesdell"
                .DatabaseName = "001"
                .UserID = "sa"
                .Password = ""
            End With

            'Get the table information from the report
            crDatabase = crReportDocument.Database
            crTables = crDatabase.Tables

            'Loop thru all tables in the report and apply the connection information for each table.
            For Each crTable In crTables
                crTableLogOnInfo = crTable.LogOnInfo
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo
                crTable.ApplyLogOnInfo(crTableLogOnInfo)
            Next

            'Set the parameter field definitions
            crReportDocument.SetParameterValue("inv_no", cboInvoices.SelectedItem)

            'Bind the report to the viewer
            CrystalReportViewer1.ReportSource = crReportDocument
End Sub
0
msmpc
Asked:
msmpc
1 Solution
 
dylanyeeCommented:
I suspect you didn't set your table location properly. try append the table location as below:

For Each crTable In crTables
      crTableLogOnInfo = crTable.LogOnInfo
      crTableLogOnInfo.ConnectionInfo = crConnectionInfo
      crTable.ApplyLogOnInfo(crTableLogOnInfo)
      crTable.Location = crTableLogOnInfo.TableName;
Next

dylan
0
 
msmpcAuthor Commented:
mlmcc...I looked over the link...I don't know what Report Designer Component 6 is...how do I know what version I'm using...also, if I try to use their code, I get an "is not defined" with the  Craxdrt part in "Dim crTable As Craxdrt.DatabaseTable "

dylan...if I add the line "crTable.Location = crTableLogOnInfo.TableName", my app throws an exception "Invalid table number"
0
Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

 
dylanyeeCommented:
Do you have subreport in your report? If so, you have to apply the same table logon info the tables in subreport.

dylan
0
 
msmpcAuthor Commented:
no subreport...I've created the report as simply as I can, just to create a sample project demonstrating how to have a Crystal Report in a vb.net application.  The report has a single parameter and displays one field from each of 3 linked tables. I have an order header, order line, and item table.  I'm trying to show the customer number (from header), item number (from line), and item description (from item) where the invoice number field in the header table (this value is unique in this table) matches the parameter value (taken from a combo box on the form)

I'm beginning to wonder it this is related to the fact that my Crystal Report was created using a Crystal Reports 8.5 and is being linked to the vb.net project with the crReportDocument.Load("C:\Program Files\MSMPC\rpt\MSMOEINV.rpt") statement.  Is there some references or namespaces that must be included for a CR 8.5 report?
0
 
msmpcAuthor Commented:
ok...problem seems to be solved.  I created the report with Crystal 10 and made no changes to the vb.net code and now it works.  Now that I think of it, seems like I read somewhere on this site that Crystal 8.5 was not supported in .NET.

0
 
dylanyeeCommented:
CR 8.5 is supported in VS.NET 2002/2003, I am not sure about VS.NET 2005.
If you are using VS.NET 2005, it might not provide backward support for some of the feature in CR 8.5 snice VS.NET 2005 comes together with CR10.

dylan
0
 
msmpcAuthor Commented:
I'm using VS.NET 2003.  All I can say is, I uninstalled Crystal 8.5 and installed Crystal 10 just out of frustration and now it seems to be working fine.
0
 
GranModCommented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now