|
I tried this code but it doesn't work. Each patient should have his own complain information. I am trying to attach patientsrough table with the compaints table using ID as the primary key but it is not working. After the user selects a patient from the listBox and clicks the view history button the application should show different complains related to different patients. Private Sub btnViewHistory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewHistory.Click pnlMain.Show() lstPatients.Visible = False lblSelectPatientName.Visible = False btnPatientAnalysis.Visible = False btnViewHistory.Visible = False lblTabPatientName.Text = txtLoginUserName.Text 'complaints database Try 'connect the database Dim conString As String = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\complaints.mdb" con.ConnectionString = conString con.Open() Dim strSQL As String = "Select * from complaints Where 'ID ='" + lstPatients.SelectedValue 'run data adapter to load dataset da = New OleDb.OleDbDataAdapter(strSQL, con) da.Fill(ds, "ComplainDataSet") con.Close() MaxRows = ds.Tables("ComplainDataSet").Rows.Count inc = -1 Catch ex As Exception MessageBox.Show(ex.Message, "Medication", MessageBoxButtons.OK, MessageBoxIcon.Information) End Try lblTabPatientID.Text = ds.Tables("ComplainDataSet").Rows(0).Item("ID").ToString() txtComplaints.Text = ds.Tables("ComplainDataSet").Rows(0).Item("complaints").ToString() chkboxComplaintsNA.Checked = ds.Tables("ComplainDataSet").Rows(0).Item("response").ToString() End Sub Someone please help! |