Solved

Cyrstal reports ADO Connection

Posted on 2001-08-04
9
228 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now