|
-
Mar 22nd, 2006, 10:30 AM
#1
Thread Starter
Lively Member
Problem with data selection in Crystal Report (Very Very Urgent)
Hi Friends,
I've used following code to display report
VB Code:
Dim rs As New ADODB.Recordset
Dim crystal As CRAXDDRT.Application
Dim Report As CRAXDDRT.Report
'CRViewer1.DisplayBorder = False
'CRViewer1.DisplayTabs = False
CRViewer1.EnableDrillDown = False
Set crystal = New CRAXDDRT.Application
Set Report = crystal.OpenReport("d:\damini\school\reports\BankLetter.rpt")
'Report.fo
' Report.FormulaFields(0) = "Mr. XXX"
rs.CursorLocation = adUseClient
rs.Open "select * from tblStudent where studentid='S15'", cn
Report.DiscardSavedData
Report.EnableParameterPrompting = False
Report.ParameterFields(1).AddCurrentValue "Mr. XXX"
Report.Database.SetDataSource rs
' Report.foru
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Do While CRViewer1.IsBusy
DoEvents
Loop
CRViewer1.Zoom 100
But instead of showing report of only that student whose id is S15, it is showing for all the records in the table. plz help me how to solve it. Early help is appreciated
plz reply soon
Last edited by damini_dd; Mar 22nd, 2006 at 10:53 AM.
-
Mar 24th, 2006, 03:59 AM
#2
Member
Re: Problem with data selection in Crystal Report (Very Very Urgent)
I think the problem is with the sql - grammar and syntax are ALL important, and not easy to troubleshoot.
It looks from your code example that the last few characters of your sql command:
rs.Open "select * from tblStudent where studentid='S15'", cn
have been commented out - after the last single quote - VB has read that last single quote as a comment starter.
Try putting gaps between the equal sign and the single quotes, thus:
rs.Open "select * from tblStudent where studentid = 'S15' ", cn
If that doesn't help ... why are you coding a specific value in a sql string anyway? Surely it would be more useful to pass a field name or some other parameter?
good luck, Peter
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
|