Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

Populate Cristal Report without DSN

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
Rosi_
Asked:
Rosi_
  • 4
  • 2
  • 2
  • +1
1 Solution
 
Elmo_Commented:
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
 
bobbit31Commented:
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
 
ChessCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Rosi_Author Commented:
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
 
Rosi_Author Commented:
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
 
ChessCommented:
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
 
bobbit31Commented:
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
 
Rosi_Author Commented:
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
 
Rosi_Author Commented:
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now