|
-
Jan 31st, 2006, 06:43 AM
#1
Thread Starter
Hyperactive Member
problem with query result on crystal report
hi,
i am facing some problem with crystal report.
i am using vb6 and crystal 9
"SELECT PRODUCT.STYLE_CODE FROM PRODUCT ,SALES_ITEM Where (PRODUCT.PRODUCT_CODE = SALES_ITEM.PRODUCT_CODE) AND (SUBSTR(PRODUCT.STYLE_CODE,1,2)='MT' OR SUBSTR(PRODUCT.STYLE_CODE,1,2)='MX') AND SALES_ITEM.ORDER_TYPE=0 AND order_date>(new_time('31-aug-2005','GMT','GMT') - to_date('01-jan-1970','dd-mon-yyyy')) * (24*60*60) group BY PRODUCT.STYLE_CODE"
this query working fine in oracle database and in vb project also i am getting result for this query.
But i am not getting any result on report.I don't know what's the problem is.
as u people said , i change the cursor .CursorLocation = adUseClient.
but no use.same blank report.
Please give me some suggestion!!!
visual basic code
VB Code:
Private Sub Command3_Click()
Dim db_conn As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim CRReport As CRAXDRT.report
Dim CrApp As New CRAXDRT.Application
'Open the Crystal Report
Set CRReport = CrApp.OpenReport("C:\Program Files\Microsoft Visual Studio\VB98\AlterationReport\Report2.rpt")
Set rs = New ADODB.Recordset
db_conn.Open "Driver={Microsoft ODBC for Oracle};" & _
"Server=test;" & _
"Uid=scott;" & _
"Pwd=tiger"
Dim sqlq As String
db_conn.CursorLocation = adUseClient
sqlq = "SELECT PRODUCT.STYLE_CODE FROM PRODUCT,SALES_ITEM Where (PRODUCT.PRODUCT_CODE = SALES_ITEM.PRODUCT_CODE) AND (SUBSTR(PRODUCT.STYLE_CODE,1,2)='MT' OR SUBSTR(PRODUCT.STYLE_CODE,1,2)='MX') AND SALES_ITEM.ORDER_TYPE=0 AND order_date>(new_time('31-aug-2005','GMT','GMT') - to_date('01-jan-1970','dd-mon-yyyy')) * (24*60*60) group BY PRODUCT.STYLE_CODE"
With CRReport
'Set the Access database path
.Database.Tables(1).Location = App.Path & "\MData"
With rs
.ActiveConnection = db_conn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open sqlq
End With
MsgBox rs(0)
.Database.SetDataSource rs, 3, 1
CRViewer91.ReportSource = CRReport
CRViewer91.ViewReport
End With
End Sub
please help me
thanks wizkid
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
|