Solved

Cyrstal reports ADO Connection

Posted on 2001-08-04
9
232 Views
Last Modified: 2013-11-23
Hello, I am using Crystal reports to create reports within my VB programs. Right now in order to create a conenction I am having to go through the set location dialog to create the connection to my database (Access 2000) My only problem is that if I then look at the source code of my porgram I can see the password to my database!! What I would like to tdo is use the dynamic ado connection I create within my program for all data access. I create this with code simialr to the following:

  With dbcon
   .Provider = "Microsoft.Jet.OLEDB.4.0"
   .Properties("Jet OLEDB:Database Password") = "password"
   .Open App.Path & "\database.mdb"
  End With

I then refer to dbcon in my recordset connections. Can I get crystal to use this some how? Or is there a way I can set the password at runtime?

Thanks
0
Comment
Question by:Ktoshni
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 

Author Comment

by:Ktoshni
ID: 6351858
Sorry - when I say I look at the source code and see the password I mean to say if I load the compiled executable into an editor I can see the password. Sorry about that!!
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6352082
As far as I know, you will not be able to prohibit anyone from looking at your executable and seeing static strings (those enclosed in quotes).

You could, perhaps, build your password string using the CHR() function and integer constants.  Simplistic, but it would hide your password from any casual observer.

Crystal Reports can make use of recordsets you create on the fly at runtime.  You must create your report using .TTX files and pass the ADO recordset.  You will still have the same problem with the password.
0
 

Author Comment

by:Ktoshni
ID: 6352219
I'm still failry new to Crystal, would you be able to give me an example of the method you mentioned? What I have noticed is that strings in my source code which contain the password do not appear when looking at the compiled program in an editor. That's why I'd prefer to use a recordset from within the program.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 0 total points
ID: 6352653
I don't understand.  Where is it that you are able to see the plain text password?  In the Crystal .RPT file, the compiled VB .EXE file, or somewhere else?

If you want to use .TTX (data definition) files for your report, follow the steps below.  Keep in mind that the .TTX file is an ASCII text file describing your recordset structure and fields.

Steps:
1.  Determine structure of the recordset in ADO
2.  Create the .TTX file (see below for option)
3.  Open designer and select More Data Sources->Active Data->Active Data (Field Defs Only) as your data source and browse to the .TTX file.  If you want, you can click the new button (optional) and use the simple Data Definition editor to create it.
4.  Define your report as usual - you can't do a meaningful preview though.
5. In VB, create your ADO recordset, let's call it rsTEST
6. Use something along the following lines to pass the recordset and preview your report.

dim crAppl as CRAXDRT.Application
dim crRep as CRAXDRT.Report
dim rs as ADODB.Recordset

' bunch of code to setup your recordset and load the data into it

set crAppl = new CRAXDRT.Application
set crRep = crAppl.OpenReport("C:\path\report.rpt")
' Set ADO recordset to first table in report
crRep.Database.Tables(1).SetDataSource rsTEST, 3
' Be sure to insert a CR Smart Viewer on form and then
crViewer1.ReportSource = crRep
crViewer1.ViewReport

0
 

Author Comment

by:Ktoshni
ID: 6375986
Thanks for the help but I think I'll live with how things are.
0
 

Author Comment

by:Ktoshni
ID: 6375992
While I would like to find a way of hiding the password. I can live with how the program is being generated
0
 
LVL 2

Expert Comment

by:Lunchy
ID: 6376214
I will add this question to the PAQ instead of deleting it, ktoshni, as there is valuable information here that should be in the database.
0
 
LVL 2

Expert Comment

by:Lunchy
ID: 6376215
Your points have been refunded and the question has been added to the PAQ database.

Lunchy
Friendly Neighbourhood Community Support Moderator

0
 

Author Comment

by:Ktoshni
ID: 6376227
OK - no problem
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to With line 4 86
vbModal 12 73
VB6 calling COM DLL written in Visual Studio 2003 6 56
Count text color with conditional formating in Excel 4 67
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question