|
-
October 7th, 2009, 06:12 AM
#1
CR viewer
I am a VB6 Programmer, Iam tyring to view a .rpt file using the CRViewer control in VB. The Report is not showing in the CR Viewer control , it gives a message Server has not yet been opened. but it is displaying when I use Access database.
I am using a SQL Server 2000 database. Could u please tell me how to connect the database to the crviewer.. Iam pasting the source code below..Kindly help.
Set cReport = appn.OpenReport(App.Path + "\reports\rptsearch.rpt")
cReport.Database.LogOnServer "pdsodbc.dll", "humaida", ldvahan, sa, sa
cReport.DiscardSavedData
CRViewer1.ReportSource = cReport
cReport.PaperSize = crPaperA4
CRViewer1.ViewReport
-
October 8th, 2009, 09:34 AM
#2
Re: CR viewer
 Originally Posted by lakuser
I am a VB6 Programmer, Iam tyring to view a .rpt file using the CRViewer control in VB. The Report is not showing in the CR Viewer control , it gives a message Server has not yet been opened. but it is displaying when I use Access database.
I am using a SQL Server 2000 database. Could u please tell me how to connect the database to the crviewer.. Iam pasting the source code below..Kindly help.
Set cReport = appn.OpenReport(App.Path + "\reports\rptsearch.rpt")
cReport.Database.LogOnServer "pdsodbc.dll", "humaida", ldvahan, sa, sa
cReport.DiscardSavedData
CRViewer1.ReportSource = cReport
cReport.PaperSize = crPaperA4
CRViewer1.ViewReport
for your code, you have to seeting a
ODBC called "humaida"
databases "ldvahan"
user id "sa"
password "sa"
Code:
DIM ldvahan as String
dim UserId as string ''login onto SQL Server DataBase
dim PWd as string ''password
ldvahan="namedatabase"
userid="mylogin"
PWD="password"
cReport.Database.LogOnServer "pdsodbc.dll", "humaida", ldvahan, sa, sa
-
October 9th, 2009, 05:18 AM
#3
Re: CR viewer
thanks .......
it is working
-
October 9th, 2009, 06:18 AM
#4
Re: CR viewer
I want to pass parameter from form to reports. how to pass this parameter in CRVIEWER....
please help me thanks in advance
-
October 13th, 2009, 03:49 AM
#5
Re: CR viewer
If you have created the parameters in your CR already then just use in your VB6 code the Parameters collection to specify and set their values.
Code:
oReport.ParameterFields.Items(1).ClearCurrentValueAndRange
oReport.ParameterFields.Items(1).Add strValue1
oReport.ParameterFields.Items(2).ClearCurrentValueAndRange
oReport.ParameterFields.Items(2).Add strValue2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|