Solved

Cyrstal reports ADO Connection

Posted on 2001-08-04
9
231 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

821 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