crystal report data refresh problem

jt12345

New member
Joined
Apr 5, 2006
Messages
1
Programming Experience
Beginner
I'm using vb.net2003.And I try to build a form with the view.Since my data in database is for testing.so, random to input it.
After I have built the report,then remove the Testing data,and enter the correct data.
After that,I run the form,I discover that the data is still the testing data.how can I solve it.I want the report to get the data according to the database when i open the form.

Can any one help me,plz.Here is my code:



Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load
Dim rpt As New MemberApplicationHistory1
Dim myConnection As oledbConnection
Dim MyCommand As New OleDbCommand
Dim dataAdpater As New OleDbDataAdapter
Dim dataSet As New dataSet

Try
myConnection = New oledbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Project.mdb;Persist Security Info=false;Jet OLEDB:Database Password =3238")
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT m.Member_ID,a.Member_ID,a.Course_Code,a.Course_Name, a.Registration_Date from Apply a, Member m where (a.Member_ID = m.Member_ID) and (m.Member_ID = a.Member_ID) "
MyCommand.CommandType = CommandType.Text
dataAdpater.SelectCommand = MyCommand
dataAdpater.Fill(dataSet, "Apply")
rpt.SetDataSource(dataSet)
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
 
Try this

If the form is accessing the correct data, you need to update the report to use that data.
In the report, use the Field Explorer and right click on Database Fields. Choose 'Set Location' and replace with the correct dataset. You should also use Verify Database in the right click options to refresh the database.
 
Back
Top