1. the dataset on hand can't connect to the crystal report viewer... please help!
2. how to design crystalReport1.rpt by pure vb code? (current using blank report)
CODE
Private Sub crv()
Try
If (txtHospNo.Text <> "" Or txtHKID.Text <> "") Then
Dim connStr As String = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & dbPath & dbTarget
Dim conn As OleDbConnection = New OleDbConnection(connStr)
conn.Open() ' open connection
Dim sqlStr As String = "SELECT Treatment.TreatDate, TreatmentIma.ImageNo, Treatment.Progress, Treatment.Therapist, Treatment.NextApp FROM (HospitNo INNER JOIN TreatmentIma ON HospitNo.HospNo = TreatmentIma.HospNo) INNER JOIN Treatment ON HospitNo.HospNo = Treatment.HospNo GROUP BY Treatment.TreatDate, TreatmentIma.ImageNo, Treatment.Progress, Treatment.Therapist, Treatment.NextApp, HospitNo.HospNo, HospitNo.HKID HAVING(([HospitNo]![HospNo] = '" & txtHospNo.Text & "' or [HospitNo]![HKID] ='" & txtHKID.Text & "')) ORDER BY Treatment.TreatDate, TreatmentIma.ImageNo, HospitNo.HospNo"
Dim sqlCmd As OleDbCommand = New OleDbCommand(sqlStr, conn)
Dim adapter As OleDbDataAdapter = New OleDbDataAdapter(sqlCmd)
Dim dataset As DataSet = New DataSet
adapter.Fill(dataset, "Progress")
adapter.FillSchema(dataset, SchemaType.Source, "Progress")
Dim dataTable As DataTable = dataset.Tables("Progress")
Dim rowCount As Integer = dataset.Tables("Progress").Rows.Count
Dim rpt As CrystalReport1 (added solution explorer)
rpt.SetDataSource(dataset)
CrystalReportViewer1.ReportSource = rpt
CrystalReportViewer1.Show()
conn.Close()
Else
MessageBox.Show("No data !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
Catch ex As Exception
End Try
End Sub