Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database logon to a Crystal at runtime in VB.NET & Stored Procedure

Status
Not open for further replies.

omacron

Technical User
Feb 5, 2002
149
Trying to created a vb.net program to run some existing crystal reports. Doing a test program this code correctly ran the report;

Code:
Dim cryRpt As New ReportDocument
        cryRpt.Load("C:\MyCrystalReport1.rpt")
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
The issue being that it requires the user to enter in the database logon information. As you can guess this is a big no no...

So found this extremely helpful FAQ (please do not link to this as the answer)


The problem is the Crystal Reports uses a stored procedure. so when report is run it returns an error on this line;
Code:
table.Location = crConnectionInfo.DatabaseName & ".dbo." & table.Location.Substring(table.Location.LastIndexOf(".") + 1)
With the error;
Code:
The table 'MyStoredProcedure;1' could not be found. Error in File My Report {DB40FA45-0294-4C59-AD34-703FED5BBF76}.rpt: The table could not be found.

Before you ask "Is the stored procedure there?", it is. The report can be run from the database in Crystal Reports and stated above if the logon is not passed the report works correctly. If it helps this is what that line of code is exciting;
Code:
"MyDatabase.dbo.Proc(MyStoredProcedure;1)"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top