Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3960286
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:50:10+00:00 2026-05-20T02:50:10+00:00

I corrected the spelling mbd to mdb but now the error is Micorsoft Jet

  • 0

I corrected the spelling mbd to mdb but now the error is

Micorsoft Jet database engine cannot find the input table or query employee make sure it exist and that its name is spelled correctly.

What I want to do is connect to database and extract four fields in the texbox here is my code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace Empdetails
{
    public partial class EGUI : Form
    {

        private OleDbConnection dbConn; // Connectionn object
        private OleDbCommand dbCmd;     // Command object
        private OleDbDataReader dbReader;// Data Reader object
        private Emp1 Edetails;
        private string sConnection;
        private string sql;


        public EGUI()
        {

            InitializeComponent();
        }

        private void button1_Click(object sender,System.EventArgs e)
        {



            try
            {
                // Construct an object of the OleDbConnection 
                // class to store the connection string 
                // representing the type of data provider 
                // (database) and the source (actual db)
                sConnection =
                    "Provider=Microsoft.Jet.OLEDB.4.0;" +
                    "Data Source=employee.mdb";

                dbConn = new OleDbConnection(sConnection);
                dbConn.Open();

                // Construct an object of the OleDbCommand 
                // class to hold the SQL query. Tie the  
                // OleDbCommand object to the OleDbConnection
                // object
                sql = "Select * From employee";
                dbCmd = new OleDbCommand();
                dbCmd.CommandText = sql;
                dbCmd.Connection = dbConn;

                // Create a dbReader object 
                dbReader = dbCmd.ExecuteReader();

                while (dbReader.Read())
                {
                    Edetails = new Emp1
                        (dbReader["Name"].ToString(), dbReader["Address"].ToString(), dbReader["SocialSecurityNumber"].ToString(), dbReader["Rate"].ToString());
                    textBox1.Text = dbReader["Name"].ToString();
                    textBox2.Text = dbReader["Address"].ToString();
                    textBox3.Text = dbReader["SocialSecurityNumber"].ToString();
                    textBox4.Text = dbReader["Rate"].ToString();






                    // tb1.Text = dbReader["FirstName"].ToString();
                }    // tb2.Text = dbReader["LastName"].ToString();

                dbReader.Close();
                dbConn.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("exeption" + ex.ToString());


            }

        }

        private void EGUI_Load(object sender, EventArgs e)
        {

        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:50:10+00:00Added an answer on May 20, 2026 at 2:50 am

    Tim and binil are right, you need to provide the full path. I tested your code and it works when you add the full path

           try
            {
                // Construct an object of the OleDbConnection 
                // class to store the connection string 
                // representing the type of data provider 
                // (database) and the source (actual db)
                string sConnection =
                    "Provider=Microsoft.Jet.OLEDB.4.0;" +
                    "Data Source=C:\\Code\\StackOverflowSamples\\ReadFromAccessDB\\employee.mdb";
    
                using (OleDbConnection dbConn = new OleDbConnection(sConnection))
                {
                    dbConn.Open();
    
                    // Construct an object of the OleDbCommand 
                    // class to hold the SQL query. Tie the  
                    // OleDbCommand object to the OleDbConnection
                    // object
                    string sql = "Select * From employee";
                    OleDbCommand dbCmd = new OleDbCommand();
                    dbCmd.CommandText = sql;
                    dbCmd.Connection = dbConn;
    
                    // Create a dbReader object 
                    using (OleDbDataReader dbReader = dbCmd.ExecuteReader())
                    {
    
                        while (dbReader.Read())
                        {
                            Console.WriteLine(dbReader["EmployeeName"].ToString());
                            Console.WriteLine(dbReader["Address"].ToString());
                            Console.WriteLine(dbReader["SSN"].ToString());
                            Console.WriteLine(dbReader["Rate"].ToString());
                        }
    
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("exeption" + ex.ToString());
    
    
            }
            Console.ReadLine();
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Correct me if I'm wrong, but a build is a compile, and not every
Someone please correct me if I'm wrong, but parsing a yyyy/MM/dd (or other specific
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
Given your data stored somewhere in a database: Hello my name is Tom I
I'm developing a WCF Data Service to expose a database. I want to provide
Correct me if I am wrong, int is 4 bytes, with a range of
Am I correct in assuming that the only difference between "windows files" and "unix
What is the correct way to import a C++ class from a DLL? We're
If I understand correctly, ClickOnce only checks for prerequisites with the first install of
Is it correct to link a static library (.lib) compiled with VS 2005 with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.