Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

configuring an As400 connection to VB 2008

Status
Not open for further replies.

ME55

Programmer
Oct 1, 2008
1
0
0
CA
Hi:

I did copy good sample from your site "faq769-6229' and looked great. However, I got 3 error :
1. odbcConnection not defined.
2. odbcCommand not defined.
3. odbcDataReader not defined.

Iam using MS VB 2008, and it might be because of the VB version.

Could some one help please. The code is below my name.

Thanks

Private Sub AS400Connect()

Dim FirstCenter As String = "426"
Dim LastCenter As String = "444"

'Define the ODBC Connection string
Dim MyODBCConnection As New odbcConnection("Driver={Client Access ODBC Driver (32-bit)};" & _
"System=ARRAKIS;" & _
"TRANSLATE=1;" & _
"Uid=UserID;" & _
"Pwd=User Password")

'Open the connection
MyODBCConnection.Open()

'Define the SQL statement to extract the data from the AS400
Dim SelectCommand As odbcCommand = New odbcCommand("SELECT * FROM ODVFILELIB.MTD02L6 WHERE(MTD02L6.FRFWS >= FirstCenter And MTD02L6.FRFWS <= LastCenter) order by MTD02L6.FRFWS", MyODBCConnection)

Dim dr As OdbcDataReader = SelectCommand.ExecuteReader

Try
'set the mouse to show a wait cursor
Me.Cursor = Cursors.WaitCursor

'Start the reading loop
While dr.Read
Dim TheFrameCode As String
TheFrameCode = dr.getString("1")
End While

Me.Cursor = Cursors.Default

Catch ex As Exception

End Try

End Sub

 



Hi,
Code:
   Dim MyODBCConnection As New odbcConnection

   'Open the connection
   MyODBCConnection.Open "Driver={Client Access ODBC Driver (32-bit)};" & _
           "System=myAS400;" & _
           "Uid=[b]" & UserID & "[/b];" & _
           "Pwd=[b]" & UserPassword & "[/b]

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top