Solved

Populate Cristal Report without DSN

Posted on 2002-06-18
9
195 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_
[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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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
 

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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month6 days, 22 hours left to enroll

622 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