0

hello,
Im using VB6 and have connected my datagid OLE to a table in Oracle using adodb, the code seems clean but it doesn't display the table. PID is a patient ID variable.
Here's the code:

Dim oconn As New ADODB.Connection
Dim rsView As New ADODB.Recordset
Dim strSqlView As String

Set oconn = New ADODB.Connection
oconn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=work;Persist Security Info=True"
oconn.CursorLocation = adUseClient

Set datagrid_view.DataSource = Nothing

strSqlView = "Select previous_casehistory.date_of_visit, previous_casehistory.doctor, previous_casehistory.dept, "
strSqlView = strSqlView + "previous_casehistory.ailment, previous_casehistory.drug_prescribed"
strSqlView = strSqlView + " from previous_casehistory where previous_casehistory.patient_id =" + "'" + PID + "'"

rsView.Open strSqlView, oconn, adOpenStatic, adLockOptimistic, adCmdText

If (rsView.EOF = False) Then
Set datagrid_view.DataSource = rsView
End If
rsView.Close

By debugging I know that the recordset is not empty. I have tried replacing the string query with a simpler query but that is not displayed either. Am I missing something?? Please help.

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by nisrin
0

Should have replied earlier, thank you! Works fine now..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.