f



ADO Connection To AS400 - Error

Hi All

Hope someone can help me here as I am losing the plot fast.
I am attempting to import data from an AS400 table (The application is
Mapics)
into forms in a Lotus Notes application

Below is the code that I use to connect to the AS400. However when I
attempt to display any value from the record set I get a type mismatch
error. If I change the connection to point to a table in a non-mapics
library I am able to display the value with no problem.

The user profile I am logging on with has the required authority.
I have retrieved data using ADO and Delphi before so this should work.

Has anyone any ideas please.

Thanks in advance for any help.

' ============================================
' The code used
' ============================================

	Dim workspace As New NotesUIWorkspace
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim doc As NotesDocument
	Dim OpDoc As NotesDocument
	Dim mConn As Variant
	Dim mRS As Variant
	Dim OperationsView As NotesView
	Dim LString As String
	
	Set db = session.CurrentDatabase
	Set mConn = createobject("ADODB.Connection")
	With mConn
		.Provider = "IBMDA400.DataSource.1"
		.Properties("Data Source") = "IP ADDRESS"
		.Properties("User Id") = "USERNAME"
		.Properties("Password") = "PASSWORD"
		.Properties("Transport Product") = "Client Access"
		.Properties("SSL") = "DEFAULT"
		.Properties("Force Translate") = "65535"
		.Properties("Convert Date Time To Char") = "TRUE"
		.Properties("Catalog Library List") = "AMFLIBA"
		.Open
	End With 
	
	Set mRS = createobject("ADODB.Recordset")
	Set mRS.ActiveConnection = mConn
	LString = "select * From AMFLIBA.MOMAST"
	mRS.Open LString
	
	Set OperationsView = db.GetView("DTrackingByLineItem")
	If (Not OperationsView Is Nothing) Then
		Do While Not mRS.eof
                  ' I Get A Type Mismatch here
			Messagebox  Cstr(mRS.fields("CALD").Value)
			mRS.movenext
		Loop
	End If
	
	mRS.close
	Set mRS =Nothing
	
	mConn.close
	Set mConn = Nothing
0
iwilson
2/18/2004 4:12:49 PM
comp.lotus-notes.programmer 2966 articles. 0 followers. Post Follow

1 Replies
677 Views

Similar Articles

[PageSpeed] 26

I have just found the solution (set the mConn.Properties("Force
Translate") = "37"). Can anyone explain why Lotus Notes/ADO requires
that the value be set to 37 and all other data transfer processes
(Delphi/ADO, Client Access File Transfer, Linked Tables To AS400 from
MS Access via Client Access ODBC Connection etc) will allow data
transfer with Force Translate = 65535 no matter what AS400
library/file is accessed.

CCSID values on files in other AS400 libraries are 37 and 285 yet I
can read the data with the CCSID = 65535

 	With mConn
 		.Provider = "IBMDA400.DataSource.1"
 		.Properties("Data Source") = "IP ADDRESS"
 		.Properties("User Id") = "USERNAME"
 		.Properties("Password") = "PASSWORD"
 		.Properties("Transport Product") = "Client Access"
 		.Properties("SSL") = "DEFAULT"
> 		.Properties("Force Translate") = "65535"
 		.Properties("Force Translate") = "37"
 		.Properties("Convert Date Time To Char") = "TRUE"
 		.Properties("Catalog Library List") = "AMFLIBA"
 		.Open
 	End With
0
iwilson
2/19/2004 10:29:00 AM
Reply: