Passing auth info for sql 2008 to crystal report from vb2010

I have a crystal report that runs in crystal IDE and when called from VB6.
In visual studio 2010 vb I have a form with a report viewer an I have loaded the report into VS. The report runs but every time I run it asks for user name and password.

When the report selection is clicked from menu I .show the form and the report is there, but I have to enter creds.

Is there any way to simply pass the creds and let Crystal do the prompting and report?

Here is the code in the form with the viewer

even though the "report is declared, vb say declaration needed
Crystalcreds.docx
Jeff_KingstonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Try your code without the refresh.
Just view it

mlmcc
0
Jeff_KingstonAuthor Commented:
Doesn't work,  even though report is dimmed above the "report" in the code section vs says is not defined???
0
mlmccCommented:
Which line is it pointing to on the error?

Are you using the CR Version for VS2010 or a standalone Crystal?

mlmcc
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Jeff_KingstonAuthor Commented:
The form has a crystalreportviewer  " crystalreportviewer1"

The report is on a server, and runs from crystal 2011 IDE and when called from VB6



Imports System.Data.SqlClient
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine
Public Class frmCompletedSeminar
    Dim report As New ReportDocument
    Dim connection As String
    Dim ServerName As String = ".mcle_sql2008\mcle_sql2008"
    Dim DatabaseName As String = "imis_mcle_prod"
    Dim UserID As String = "sa"
    Dim Password As String = "donaldduck"
    Dim subreport As ReportDocument
--
-- “report” below (each time used)     says declaration expected
--
    report.Load(j:\crystalreports\evaluations\completedseminaranalysis.rpt")
--
-- “crystalreportviewer1” below says declaration expected
--
  CrystalReportViewer1.ReportSource = report
  report.DataSourceConnections.SetConnection(ServerName, DatabaseName, UserID, Password)



  --
  -- For next loop is flagged as syntax error – probably due to the errors above.
  --

  For Each subreport In report.Subreports
     report.subreport.DataSourceConnections.SetConnection(ServerName, DatabaseName, UserID, Password)
    Next
    ‘CrystalReportViewer1.RefreshReport()

    Private Sub CrystalReportViewer1_Load(sender As System.Object, e As System.EventArgs) Handles CrystalReportViewer1.Load

    End Sub
End Class

Open in new window

0
mlmccCommented:
Was the report built against a database originally?

mlmcc
0
Jeff_KingstonAuthor Commented:
Yes  There are several reports in this application.  Some use files as a data source, some use stored proc edures
0
mlmccCommented:
You may need to rebuild the report or at least change its data source to a dataset/xml file.
I believe until you do that it will always want to log into the database.
Assuming the database exists you could change the code to provide that log in.

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeff_KingstonAuthor Commented:
I will do some research on how to do the change of datasource, but to be truthful, to break a process that has been running for 15 years because SAP and MSFT can't get along proves these guys don't give a damn about the existing user base.  I truly appreciate your assistance and direction. Now I'll have to go about modifying 18 reports and how they are run from VS2010

Have a great weekend.
0
Jeff_KingstonAuthor Commented:
Not what I was hoping to hear, but it is what it is.  Too bad these outfits don't have the financial restraints that small business has, maybe there would be more consideration in breaking things every time they feel it is in their interest.
0
mlmccCommented:
It may be as simple as creating the dataset then using the SET DATA SOURCE LOCATION option in the designer to change to the new source.

mlmcc
0
Jeff_KingstonAuthor Commented:
In VB6 the code is:

Private Sub Form_Load()

    Screen.MousePointer = vbHourglass
    Set Cry = New CRAXDRT.Application
    Set Rep = Cry.OpenReport _
    ("j:\CrystalReports\Evaluations\completedseminaranalysis.rpt")
    Rep.Database.LogOnServer "p2sodbc.dll", "iMIS___MCLE-APP_iMIS15", "imis_mcle_prod", "userid", "password"
    Rep.DiscardSavedData
    'Rep.ParameterFields(1).ClearCurrentValueAndRange
    'Rep.ParameterFields(1).AddCurrentValue frmControl.txtProductCode.Text
    With CRViewer91
        .ReportSource = Rep
        .RefreshEx True
        .Refresh
        .ViewReport
        .EnableExportButton = True
    End With
        Cry.CanClose
        Set Cry = Nothing
    Screen.MousePointer = vbDefault
End Sub



In vs:

1. I create a form and put a reportviewer on it.
2. I load the external report into the viewer and save as part of the project.
3. From menu I click the report I want that shows the form.
4. On load the form shows the reportviewer, and at this point I am prompted for the password for the database.

If I enter the password, the report prompts me for parameters correctly and runs the report flawlessly.



There must be a simple replacement for this code to allow the rport direct access to the database without prompting!

  Rep.Database.LogOnServer "p2sodbc.dll", "iMIS___MCLE-APP_iMIS15", "imis_mcle_prod", "userid", "password"
0
mlmccCommented:
Check these documents on migrating from the VB6 to .Net assemblies

http://scn.sap.com/docs/DOC-21971

https://msdn.microsoft.com/en-us/library/ms225492(v=vs.80).aspx

mlmcc
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.