SQL in DB2

i was already able to connect to DB2 (in AS/400).

how can i get a result set after conecting? can i use SQL command? do you have any sample program?

ty

Subject: SQL in DB2

try this:using a dept code I go to the as400 and retrieve all the people in a dept

Sub Get400Data

Dim con As  New ODBCConnection

Dim qry As  New ODBCQuery

Dim res As  New ODBCResultSet

Dim hd As String

Dim newdoc As NotesDocument

Dim Dept As String

Const Err1 = "This SSN was not on file - please enter the information manually"

Dept = doc.Dept(0)



REM get record of user

server = db.Server

DataSource = "AS400Name"



REM make the odbc connection

status = con.ConnectTo(DataSource,"USRPRF","PWD")



If status = False Then

	Messagebox "Connection to AS400 could not be made"

	Exit Sub

End If	



Set qry.connection = con

qrywhere = | WHERE pddept='| & Dept & |'|  



qryslt = "Select * from LIB.FILE "  & qrywhere 

qry.SQL =qryslt

Set res.query = qry

Call res.execute



If res.IsResultSetAvailable Then

	Do

		res.NextRow

		set newdoc = db.CreateDocument

		newdoc.Form = "Person"

		Call newdoc.ReplaceItemValue("FirstName",res.GetValue("pdfnam"))	

		Call newdoc.ReplaceItemValue("LastName",res.GetValue("pdlnam"))	

		Call newdoc.ReplaceItemValue("Address1",res.GetValue("pdadd1"))	

		Call newdoc.ReplaceItemValue("Address2",res.GetValue("pdadd2"))	

		Call newdoc.ReplaceItemValue("City",res.GetValue("pdcity"))	

		Call newdoc.ReplaceItemValue("State",res.GetValue("pdst"))	

		Call newdoc.ReplaceItemValue("zip",res.GetValue("pdzip"))	

		Call newdoc.ReplaceItemValue("JobTitle",res.GetValue("pdjdes"))	

		Call newdoc.ReplaceItemValue("Dept",res.GetValue("pddept"))	

		Call newdoc.save(True,False)

	Loop Until Res.IsEndOfData

End If

End Sub

thanks

barry