Solved

Populate Cristal Report without DSN

Posted on 2002-06-18
9
182 Views
Last Modified: 2010-05-02
Hi

I have made an application in Visual Basic that connects to SQL-Server without using a DSN. (just a simple connectionstring)

Now, if I want to make a Cristal Report it looks like I need to make a DSN.

Is there any way to work around this problem?  

Thans a lot!

Rosie
0
Comment
Question by:Rosi_
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 3

Expert Comment

by:Elmo_
ID: 7089501
Rosie,

Are you Using the Crystal Reports Control(crystl32.ocx)?

Could you post the Connect String that you are using so I could Have a look at it?

Cheers,

Ed.
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7090267
if you want to set your connection string when you make a new report... when you select your database use these options:

more datasources/active data/active data (ADO)

select the ado and oleDB radio button
then put your connection string in the textbox
0
 
LVL 1

Expert Comment

by:Chess
ID: 7090844
You can use a DSN less connection, just like you already have connecting to SQL-server.  Use the same connection string.  Add code similar to this:
-------------------------------------
sreport_name = "rpt_swap_valuation.rpt"
   
   sreport_name = App.Path & "\REPORTS\" & sreport_name
   
   Set crreport = crapplication.OpenReport(sreport_name)
   For i = 1 To crreport.Database.Tables.Count
       crreport.Database.Tables(1).SetLogOnInfo gServerName, gDbName, gLogin, gPassword
       crreport.Database.Tables(1).Location = gDbName & ".dbo." & "Get_Swap_Appraisal"
   Next i
   crreport.ParameterFields(1).AddCurrentValue (sreport_fund_num)
   crreport.ParameterFields(2).AddCurrentValue (CDate(sreport_processingdate))
   crreport.ParameterFields(3).AddCurrentValue (gFundgroupnumber)
   frmReport.rptViewer.ReportSource = crreport

   frmReport.rptViewer.ViewReport
   frmReport.Show
0
 

Author Comment

by:Rosi_
ID: 7091931
My first answer is for Elmo:
I haven no idea wich one... sorry
My connectionstring:
strSecConn = "Provider=SQLOLEDB.1;Integrated        
    Security=SSPI;Persist Security Info=False;" & _
    "Initial Catalog=" & strSecDatabank & ";Data Source="
    & strSecServer
where I fill the variables with values I read from an Ini-file.

To bobbit31:
I cannot find the options you specified ... sorry
I can tell you I have productn° 4.6.1.0 and CRW32 4.6.1.116.  Maybe an old version?

To Chess:
thanks, I'll try it right away!

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:Rosi_
ID: 7091951
Chess, I'm gonna need some more help.
Cause, if I open the Crystal Reports then I can only choose to create a new report before doing anything else.
Also: where do I put the code?
0
 
LVL 1

Expert Comment

by:Chess
ID: 7092510
You can pass in the name of an existing report. In the code that I have posted above, "rpt_swap_valuation.rpt" is the name of the report.  It is using a stored procedure called "Get_Swap_Appraisal".

If you need to open the report based on some user action such as clicking a command button, then put the code in the click event of the command button.  

If you still need more clarification, please post your code in full.
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 300 total points
ID: 7092666
ahh... you are using an old version of crystal reports.
I use crystal 8.0, so that's probably why you don't see the same options.  I don't know how to do it (or even if you can) in cr 4.6
0
 

Author Comment

by:Rosi_
ID: 7095975
Well, first I'm going to try the get my hands on that latest version!

I won't forget you guys to make one of you happy with my 300 points!
0
 

Author Comment

by:Rosi_
ID: 7126469
Problem solved by using a newer version of Crystal Reports, so the points go to..... Bobbit31
Thanks a lot for all the help!
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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
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…

863 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

25 Experts available now in Live!

Get 1:1 Help Now