Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Data-grid population problems

$
0
0

Hi,

I am having a little problem that is driving me mad . When trying to fill my data-grid noting happens . No error or noting . The only thing i can see is when i run the application a red x is put on my database in the server explorer and when i refresh it it will return to normal. 

Any help would be appreciated.

Thanks.

 private void btnSearch_Click(object sender, EventArgs e)
        {
            searchAll();


        }


        public void searchAll()
        {

            OleDbConnection conToDataBase = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Resources\health_plus.accdb;Persist Security Info=True");
            OleDbCommand searchAllCom = new OleDbCommand("SELECT * FROM Doctors", conToDataBase);

            conToDataBase.Open();

            searchAllCom.CommandType = CommandType.Text;
            OleDbDataAdapter searchDocAdapter = new OleDbDataAdapter(searchAllCom);
            DataTable doctorsTable = new DataTable();

            searchDocAdapter.Fill(doctorsTable);

            searchDoctorDataGrid.DataSource = doctorsTable;

        }


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>