hi
i m making a c# app which reads data from ms accesss & display it in textbox i have tried the following method but that didn't worked suggest me smthing or correct my code pls

 myconn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\nature bliss\Desktop\Stock\section1.accdb;Persist Security Info=False");
                        try
                        {
                            OleDbCommand cmd = new OleDbCommand();
                            cmd.Connection = myconn;
                            cmd.CommandText = "select * from section1";

                            myconn.Open();
                            //MessageBox.Show("Sucessfully Connected to " + myconn.DataSource.ToString());
                            var reader = cmd.ExecuteReader();
                            while (reader.Read())
                            {
                                textBox1.Text = reader["Name"].ToString();
                            }


                            myconn.Close();


                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(""+ex);
                        }
                        finally
                        {
                            myconn.Close();
                        }

How did it not work? Need a bit more information to go on.

The only suggestion I can make now is that your query isn't returning any rows.

This question has already been answered. Start a new discussion instead.