INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

configuring an As400 connection to VB 2008

configuring an As400 connection to VB 2008

(OP)
Hi:

I did copy good sample from your site "FAQ769-6229: Create a connection to an AS400' 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

 

RE: configuring an As400 connection to VB 2008




Hi,

CODE

   Dim MyODBCConnection As New odbcConnection

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

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close