Using AS400File Recordset Object in VB.Net
From Support
The following sample VB.Net program reads a record from an iSeries file and retreives a value from the rs (RecordSet) object. In VB.Net you must refer to the .Value property to get the actual field value. Otherwise VB.Net will cause an error. This is because VB.Net is more strict about referring to data types.
Dim obj400File As Object
Dim rtn As Long
Dim value As String
'Create AS400 File Object
obj400File = CreateObject("ASP400.AS400File")
'Connect to iSeries
rtn = obj400File.Connect("1.1.1.1", "USER","PW")
'Open File
rtn = obj400File.OpenFile("QCUSTCDT", "QIWS","*FIRST", "*FIRST", False, False)
'Move to First Record
rtn = obj400File.MoveFirst
'Return ADO.Field Value from iSeries Record
value = obj400File.rs("CUSNUM").Value
'Close iSeries File
obj400File.CloseFile()
Categories: ASP/400 | Knowledge Base | How To | TBPR
