0
OleDbConnection connect = new OleDbConnection ("Provider=Microsoft.ACE.OLEDB.12.0;Data source:C:\\Users\\PC\\Documents\\Visual Studio 2013\\Projects\\WindowsFormsApplication1\\WindowsFormsApplication1\\Firebird damagem0.accdb;Persist Security Info=False");

public partial class Form3 : Form
    {
        // OleDbconnection database
        OleDbConnection connect = new OleDbConnection ("Provider=Microsoft.ACE.OLEDB.12.0;Data source:C:\\Users\\PC\\Documents\\Visual Studio 2013\\Projects\\WindowsFormsApplication1\\WindowsFormsApplication1\\Firebird damagem0.accdb;Persist Security Info=False");

        public Form3()
        {
            InitializeComponent(); 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // Set up command

            connect.Open();
            OleDbConnection command = new OleDbConnection("SELECT [Damage columns], ID FROM [Copy of Firebird m0 damage]; connection");
            command.ExecuteNonQuery();
            DataTable ds = new DataTable();
            OleDbDataAdapter da = new OleDbDataAdapter (command);
            da.Fill(dt);
            foreach (DataRow dr in dt.Rows)
            {
                comboBox3.Items.Add(dr["[Damage columns]"].ToString());

            }

            connect.Close();
        } 

Error occurs at connect.Open(); I've done everything right but i still keep receiving the error, any suggestions?

Alex K.
  • 171,639
  • 30
  • 264
  • 288
James B
  • 1
  • 1

3 Answers3

0

This error is typically due to an invalid connection string.

Since you have a space in your datasource path, try wrapping it with single quotes. Also, it should be

Data Source=

not

Data Source:
Cory
  • 1,794
  • 12
  • 21
0

You connection string looks to be wrong with a semicolon after Data Source.

OleDbConnection connect = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data source=C:\Users\PC\Documents\Visual Studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Firebird damagem0.accdb;Persist Security Info=False");

Also you have another OleDbConnection there in code which should be OleDbCommand. And finally, did you install the access database engine?

Cetin Basoz
  • 22,495
  • 3
  • 31
  • 39
0

I just managed to produce a very similar error out of thin air (it worked before) and after a while of digging around what I changed since then I finally found the mistake:

Provider=Microsoft.Jet.OleDb.4.0;Data Source=myfile.mdb

works, while

Provider=Microsoft.Jet.OleDb.4.0;DataSource=myfile.mdb

produces

Installable ISAM not found

For those who don't see it: The difference is the spelling of the key Data Source vs DataSource - the space character is important here!

JensG
  • 13,148
  • 4
  • 45
  • 55