[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Define OleDbConnection - what? how? thought it was.

Posted on 2004-11-16
1
Medium Priority
?
827 Views
Last Modified: 2008-01-09
I have a form with 3 lablels on it and one text box and one button.
I have made connections to the database using the Data Connection wizzards so now I have an OleDbDataAdapter, OleDbConnection, and DataSet....not sure if that matters but...
When I use the following code in my VB.NET project it underlines OleDbConnection, OleDbCommand  and OleDbDataReader saying "Type OleDbCommand is not defined"
What Do I need to do to define them to get this code to work?

  -----------------------------------------------------------------  

   Dim Connection As OleDbConnection = New OleDbConnection(YourConStr)
        Dim Command As OleDbCommand = New OleDbCommand("SELECT SocSecNo FROM CustomerMaster WHERE SocSecNo='" & txtSocNo.Text & "' AND LastActiveDate BETWEEN '" & Now() & "' AND '" & Now() - 5, Connection)
        Dim DataReader As OleDbDataReader

        Connection.Open()
        DataReader = Command.ExecuteReader
        If DataReader.Read() Then
            'Data Found Display in Labels here
            lblFirstName.Text = DataReader("FirstName")
            lblLastName.Text = DataReader("LastName")
            lblSoc.Text = DataReader("SocSecNo")
        Else
            'No data for the Particular Social ID
            'Either Empty the labels or leave it as it is
            lblFirstName.Text = ""
            lblLastName.Text = ""
            lblSoc.Text = ""
        End If
        DataReader.Close()
        Connection.Close()
------------------------------------------------------------------------
Would this be my connection string (YourConStr)

        Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Registry Path=;Data Source=""C:\Program Files\My APP\DlrData.mdb"" & _
        ";Jet OLEDB:System database=;Jet OLEDB:Global Bulk Transactions=1;Jet OL" & _
        "EDB:Don't Copy Locale on Compact=False;User ID=Admin;Provider=""Microsoft.Jet.OLE" & _
        "DB.4.0"";Jet OLEDB:Database Locking Mode=0;Jet OLEDB:SFP=False;Jet OLEDB:Encrypt " & _
        "Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Compact Without " & _
        "Replica Repair=False;Jet OLEDB:Global Partial Bulk Ops=2;Mode=Share Deny None;Ex" & _
        "tended Properties=;Jet OLEDB:Engine Type=4"
0
Comment
Question by:Matrix1000
1 Comment
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 1500 total points
ID: 12597097
You need to add the line Imports System.Data.OLEDb at the very beggining of your code.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question