Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cyrstal reports ADO Connection

Posted on 2001-08-04
9
Medium Priority
?
239 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

604 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