Results 1 to 5 of 5

Thread: Type 'OleDbConnection' is not defined

  1. #1
    ravi_dangi is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0
    Join Date
    Aug 2010
    Posts
    1
    Reputation
    0

    Type 'OleDbConnection' is not defined

    i got this error Type 'OleDbConnection' is not defined

    my code is:-
    Imports System.Data.OleDb
    Public Class View2
    Dim mycn As OleDbConnection = New OleDbConnection(cs)
    Dim Command As OleDbCommand
    Dim i As Integer
    Dim SQLstr As String
    Dim dr As OleDbDataReader
    Dim ver As Integer


    for cs means:-
    Module connection_Strings
    Public cs As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\usofverification.mdb"
    End Module

  2. #2
    kulrom's Avatar
    kulrom is offline VB.NET Forum All-Mighty
    .NET Framework
    .NET 3.5
    Join Date
    May 2005
    Location
    Republic of Macedonia
    Posts
    2,855
    Reputation
    264
    Well you have the Imports System.Data.OleDb statement on your page and everything else looks fine to me.
    I even tried to reproduce the issue creating a new project with a form named View2 and then i added module named connection_Strings.
    It works for me

  3. #3
    kulrom's Avatar
    kulrom is offline VB.NET Forum All-Mighty
    .NET Framework
    .NET 3.5
    Join Date
    May 2005
    Location
    Republic of Macedonia
    Posts
    2,855
    Reputation
    264
    Can you think of anything that may help us identifying the issue? OS, .NET FW, IDE ...?

    Maybe the compiler is not complaining about this specific declaration? Is it possible that you have another OleDbConnection object somewhere in the project?

  4. #4
    cjard's Avatar
    cjard is offline VB.NET Forum All-Mighty
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2006
    Posts
    7,036
    Reputation
    1720
    Possibly he doesnt have a reference to System.Data.OleDb DLL.. ?

    ravi, delete this project and start another one.. BUT, read the DW2 link in my signature, section "Creating a Simple Data App" - follow that Microsoft tutorial and you'll have your database program up and running in about 10 minutes, posibly less

  5. #5
    kulrom's Avatar
    kulrom is offline VB.NET Forum All-Mighty
    .NET Framework
    .NET 3.5
    Join Date
    May 2005
    Location
    Republic of Macedonia
    Posts
    2,855
    Reputation
    264
    Quote Originally Posted by cjard View Post
    Possibly he doesnt have a reference to System.Data.OleDb DLL.. ?
    Hmm it is weird cuz it does not complain about the Import directive.
    It must be something else i believe. Otherwise Imports line would be underlined by the intellisense as well. Wouldn't it?
    Last edited by kulrom; 09-09-2010 at 6:34 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking