|
-
Apr 9th, 2003, 11:16 PM
#1
Thread Starter
New Member
crystal report not refreshing data
hello,
I am using CR8 with vb6. I have created a report using icr designer. The report connects to the database using a system dsn. The report uses the tables emp_mast and pay_det. For testing I put the the fields emp_name and emp_designation from emp_mast in the report and viewed the report. It worked perfectly well.
Now my special requirement is that I will be using separate databases with the same datastructure for reporting at different occasions as I will be receiving different databases from field offices. In other words, I will be selecting the datasource for the reports every time I open the application. To try this, I tried the following code,
VB Code:
Dim Dim strSql As String
Dim rst As ADODB.Recordset
Dim cnn As ADODB.Connection
cnnString As String
Dim Report As New rptAdmitCard
cnnString = "Provider=MSDASQL; DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\mydir\mydb.mdb; UID=; PWD=;"
Set cnn = New ADODB.Connection
cnn.Open cnnString
strSql = "select * from emp_mast"
Set rst = New ADODB.Recordset
rst.Open strSql, cnn, adOpenStatic, adLockReadOnly, adCmdText
Report.Database.SetDataSource rst
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
But the report is still displaying from the old database only, not from mydb.mdb
Will someone pls tell me where I have gone wrong ???
thanx
jojy
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
|