Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to SQL Server using ASP

Status
Not open for further replies.
Feb 16, 2001
44
CA
Hi,

I have a report which is based on SQL Server stored procedure. The client version works fine. But when I use ASP to connect to report, connectivity is false.
I am using crtable.SetLogInfo "server","db","user","password"

Does anyone know why?What am I doing wrong?

Thank you.
Julia
 
hi here this might hekp you
In Crystal Reports version 8 and 8.5 ASP applications main report parameters must be set on the main report and subreport parameters must be set on the subreport. Below is some example code for passing values to a main report and subreport.
-----------------------------------------------------------

In this example the report is seen as having 4 main report parameters and 2 subreport parameters.

Note: Subreport-linking parameters do not need to be set with version 8 and 8.5.

set ReportDatabase = Session("oRpt").Database

'Set the Table object and logon (1 table only)
set crdatabasetables = ReportDatabase.Tables
set crtable = crdatabasetables.Item(1)
crtable.SetLogonInfo "ODBCDSNname", "", cstr(userid), cstr(password)

'Create subreport database object, get table(s), login
set CRSubreports = session("oRpt").OpenSubReport("testsub.rpt")
set ReportDatabase2 = CRSubreports.Database
Set crdatabasetables2 = ReportDatabase2.tables
Set CRtable2 = crdatabasetables2.Item(1)
crtable2.SetLogonInfo "ODBCDSNname", "", cstr(userid), cstr(password)

'Get handles to parameters in main report (there are 2)
set Session("ParamCollection") = Session("oRpt").Parameterfields
Set ThisParam1 = Session("ParamCollection").item(1)
Set ThisParam2 = Session("ParamCollection").item(2)

'Set values for the parameters
ThisParam1.SetCurrentValue cstr("paramvalue1"),12
ThisParam2.SetCurrentValue cstr("paramvalue2"),12

'Get handles to parameters in SUB report (there are 2)
set Session("SubRptParamCollection") = CRSubreports.Parameterfields
Set ThisParam1 = Session("SubRptParamCollection").item(1)
Set ThisParam2 = Session("SubRptParamCollection").item(2)

'Set values for the parameters (these were previously set in the main report.
ThisParam1.SetCurrentValue cstr("paramvalue4"),12
ThisParam2.SetCurrentValue cstr("paramvalue3"),12

For more sample ASP applications to use as templates for your Crystal Reports web applications please download the file aspxmps8.exe (for version 8.0) or aspxmps85.exe (for version 8.5) from our support site at:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top