Visual Basic Development Bookmark and Share   
 Home > Visual Basic General > Each Patient Should Have His Own Information
 

Each Patient Should Have His Own Information

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!
vishvishal2000  5 hours 38 minutes ago
What do you mean by 'doesn't work"? Is there an error, or are the wrong results returned or are there no results returned?

Have you paused the routineusing the debugger before you execute the query and confirmed that strSQL looks exactly like you expect?
Acamar  4 hours 27 minutes ago
Hey Acamar!


I can debug the program. But I am not getting the right results.

Right now after debugging, the application shows the same complains for every patient. Instead of each patient having their own complains.
May be the primary key from both tables is still not pulling the data from each tables.
vishvishal2000  3 hours 56 minutes ago

Make good scenario first and then implement it to the code..Keep evaluate the result in scenario, so you won't make mistake in code ;)
Harrie KalaChakra  3 hours 39 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• Select command property has not been initialized for calling command fill?
• Multilanguage mathematical application and "," to "." conversion in Spanish in VB.NET
• How to a Windows Installer from the Visual Basic version in Microsoft Word
• Datagridview combobox colume in vb2008
• Array question. Going to try in this forum.
• adding node to treeview
• Merge cell in word table generated by my app
• VB.NET 2008 DataSource Stored Procedure Change
• Can someone Explain This code for me please...
• Communicating Form.vb and UserControl.vb