Skip to Content
avatar image
Former Member

Crystal Reports for .NET SDK Sample csharp_win_dbviewer specifying wrong database

I am having trouble with one of your examples: csharp_win_dbviewer. I am using Crystal Reports Viewer for Visual Studio 2016, Visual Studio Enterprise 2015, and SQL Server Management Studio v17.2. I loaded the "pubs" database that is called for in the example, in my local SQL Server instance. I opened the example solution in VS 2015, and it did a one-way VS upgrade (this example is from 2002, I believe). The only change I made was to the physical server name literal, from "rcon1" to my local machine name.

When I ran the solution the first time, I was getting the SQL Server Error: 18456, Severity: 14, State: 38. "Login failed for user 'XYZ123\ABC456$'. Reason: Failed to open the explicitly specified database 'ReportServer'. [CLIENT: <local machine>]". Then I reloaded both the pubs database and the example solution. This second time I got the Error: 18456, Severity: 14, State: 5. "Login failed for user 'vantech'. Reason: Could not find a login matching the name provided. [CLIENT: <named pipe>]". When I change the UserID and Password literals to my own, I get the same error. This second error can happen when SQL Server does not find the database that is specified.

It seems to me that "ReportServer" is the database that the app is trying to login to after it is explicitly set to "pubs" in the code. Can you tell me how to fix this example? Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 30, 2017 at 02:12 PM

    Use one of your own reports and change the server name, database, user and PW when logging on.

    This one is a lot more complicated and you need to set parameters or comment out the code that calls the function but see it it works for you:

    The latest downloads and links to reference material is on this WIKI page:


    Add comment
    10|10000 characters needed characters exceeded