Hi all,
Im not sure where im going wrong but here is my source code
its a single access2003 DB with one table called WinAudi2
Code:BindingSource CA_bindingsource = new BindingSource(); private void button1_Click(object sender, EventArgs e) { string MyString; System.Data.Odbc.OdbcConnection cn; System.Data.Odbc.OdbcCommand cmd; MyString = "Select * from WinAudi2"; cn = new System.Data.Odbc.OdbcConnection(@"Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\Sweep.mdb;Uid=Admin;Pwd=;"); cmd = new System.Data.Odbc.OdbcCommand(MyString, cn); try { cn.Open(); CA_bindingsource.DataSource = cmd; dataGridView1.DataSource = CA_bindingsource; MessageBox.Show("Connected"); } catch (Exception ex) { //MessageBox.Show("Error with CSV backup" + Environment.NewLine + ex.Message); Console.WriteLine(ex.ToString()); MessageBox.Show("Problem" + Environment.NewLine + ex.Message); } finally { cn.Close(); }
and when i go to run the code i get this
Am i not structuring something right?





Reply With Quote