Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...One of the best run forums I have used in years! ...I like the way the site is organized and your no tolerance of flames..."

Geography

Where in the world do Tek-Tips members come from?

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

omacron (TechnicalUser)
25 Apr 12 15:29
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)

http://www.tek-tips.com/faqs.cfm?fid=4870

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)"
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close