We help IT Professionals succeed at work.
Get Started

OLE DB Error

PastorDwayne
PastorDwayne asked
on
260 Views
Last Modified: 2010-04-15
Good-day,

I have an Access 97 Database which I connect to using C# OLE DB:

****************************************
DataSet ds = new DataSet();
try
    {
                   
     OleDbConnection conn = new OleDbConnection(
     "Provider=Microsoft.Jet.OLEDB.4.0; " +
     "Data Source=" + "db1.mdb");
OleDbDataAdapter OledbAdabter1  = new OleDbDataAdapter("SELECT * FROM Table1", conn);
     OledbAdabter1.Fill(ds, "Table1");
     }
catch (Exception er)
    {
     MessageBox.Show(er.ToString());
     return;
    }

MessageBox.Show(ds.Tables[0].Rows[0][0].ToString());
****************************************************

The above code works fine; But when I want to change the SELECT command, to select only a column, or a group of column eg:

OledbAdabter1  = new OleDbDataAdapter("SELECT Col1 FROM Table1", conn);

if gives me this exception:
OleDbException: Unknown

This is only specific to one computer, as I tried the same code on a different computer and it works fine.

Here is what I have tried so far to resolve this issue:
1. Re-installed MS Visual Studio 2003.
2. Installed MDAC 2.8
3. Installed MS Jet Service Pack 8.
4. Re-installed MS Office 97.
5. Re-created the database.

None of these things seem to help; Any suggestions on how to resolve this issue?
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE