I'm using VS 2012 and coding a try/catch block in an MS Access database project, but VS says OleDbException is not defined (see line 3 in the code). Anyone know why? I got some of this code from here, and according to MSDN OleDbException is valid in vb.net

        Try
            data_adapter.Update(CType(binding_source.DataSource, DataTable))
        Catch ex As OleDbException
            MsgBox("ERROR:" & ex.Source & " " & ex.Message, MsgBoxStyle.OkOnly)
        End Try

Try to put this at the top of your code

Imports System.Data.Oledb
commented: Great :) +14

Great :)

:)

Don't forget to mark this as solved pal.

I already did that, but thanks for the reminder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.