Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 10th, 2005, 10:37 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB6 App with CR9 problem

Recently whenever I call a CR9 report from a VB6 app, I am getting the 'Set datasource dialog box up', asking me to select OLEdB SQL Server, SQL Server dB, password, username and database. This I do not want to happen.

The way I do this is as follows, I create a recordset and execute and assign a stored procedure to the recordset, then pass the recordset to CR

  Set gRst = New ADODB.Recordset
  Set gRst = fnExecuteSP(spName)"
  Set crxReport = crxApp.OpenReport(App.Path & "\CRname.rpt")
  crxReport.Database.SetDataSource gRst, 3, 1

  With crViewer9
    .Visible = True
    .ReportSource = crxReport
    .ViewReport
    .Zoom 1
  End With

This has always worked fine, though at this point ‘.ReportSource = crxReport’ I am getting the set datasource dialog box from CR.

My question is how can I get rid of the dialog and CR to stop prompting the users to select oleDB datasource and entering all the server information?. Is it the way I setup the CR report initially?


I connect to SQL Server with the following.
Public Function fnExecuteSP(strSP As String) As ADODB.Recordset
  Set gCmd = New ADODB.Command
  With gCmd
    '.ActiveConnection = "Provider=SQLOLEDB.1;" _
      & "Persist Security Info=False;" _
      & "User ID=xgjkhx;" _
      & "Password=dhkjshk;" _
      & "Initial Catalog=databaseName;" _
      & "Data Source=serverName"

    .CommandType = adCmdStoredProc
    .CommandText = strSP
    Set fnExecuteSP = .Execute
  End With
End Function

Regards
Ian






Similar Threads
Thread Thread Starter Forum Replies Last Post
Depencies for my VB6 app Tank Beginning VB 6 3 December 22nd, 2005 07:39 PM
Vb6 - CR9 (CRViewer91.Refresh) P00rS41nt VB How-To 0 November 23rd, 2005 02:37 AM
VB6 Excel App to .NET problem zayasv VB.NET 0 October 24th, 2005 04:08 PM
VB6 Excel App to .NET problem zayasv General .NET 0 October 24th, 2005 04:05 PM
Error 20515 when run CR9 from Vb6 and Access2000 Ann92 VB How-To 0 June 22nd, 2004 08:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.