Set adodb recordset from external recordset

Hi,

I hope I can explain this properly.

I am using an external object which returns a recordset.

If I use this in VB, I can set a datagrid with the returned values like this:-

Set oQuote = CreateObject(“dobj.Quotation”)

…do stuff here to get returned values…then

Set DataGrid1.DataSource = oQuote.ReturnOrderLines

This works fine and it displays all returned records in the grid.

In notes I want to be able to create a new adodb.recordset and assign the returned values to it.

Something like this

Set oQuote = CreateObject(“dobj.Quotation”)

…do stuff here to get returned values…then

Dim oRs As Variant

Set oRs = CreateObject(“ADODB.Recordset”)

set oRs = oQuote.ReturnOrderLines

do while (not oRs.eof)

…do stuff…

loop

at the ors.eof stage, I get object variable not set. I know I’m probably expecting some simplicity here which may not work but any suggestions would be appreciated.

cheers

Subject: set adodb recordset from external recordset

I have never tried a data grid object in Notes, but here is sample code to use ADO to get data from an Oracle table:

Dim adoConn As Variant

Dim adoCmd As Variant

Dim rs As Variant

Dim param As Variant

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument	



Dim strTxt As String, strConn As String, strSQL As String

Dim x As Integer



Set db = session.CurrentDatabase

Set adoConn = CreateObject("ADODB.Connection")

Set adoCmd = CreateObject("ADODB.Command")

Set rs = CreateObject("ADODB.Recordset")



strConn =  "Provider=msdaora;Data Source=eview;User Id=system;Password=manager;"



adoConn.ConnectionString = strConn

adoConn.Open



rs.CursorType = adOpenStatic

rs.CursorLocation = adUseClient

rs.LockType = adLockOptimistic



strSQL = "select * from hr.employees"



rs.Open strSQL, adoConn, , , adCmdText



Do While Not rs.EOF

	Set doc = db.CreateDocument

	With doc		

		.Form = "frmEmployee"

		.numEmpID = Cint(rs.Fields(0).Value)

		.txtFName = rs.Fields(1).Value

		.txtLName = rs.Fields(2).Value

		.txtEmail = rs.Fields(3).Value

		.txtPhone = rs.Fields(4).Value

		.dteHire = Cdat(rs.Fields(5).Value)

		.txtJobID = rs.Fields(6).Value

		.numSalary = rs.Fields(7).Value

		.numCommPct = rs.Fields(8).Value

		.numMgrID = rs.Fields(9).Value

		.numDeptID = rs.Fields(10).Value

		.txtDistName = rs.Fields(11).Value

				'.computeWithForm True,False

		.Save True,False

	End With

	rs.MoveNext

Loop



rs.Close

adoConn.Close



Set adoConn = Nothing

Set adoCmd = Nothing

Subject: RE: set adodb recordset from external recordset

Hi Jimmy,

thanks for taking the time to respond. I’m not actually using the grid its just that I have to use this proprietry software which works in VB with the grid. I was just trying to do the same using a normal recordset in Notes.

I have now decided to try a different way - no doubt I’ll be asking some questions about that too.

Thanks again