Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have Gridview (gridview1), some TextEdits in the Form and add some Data's to few rows and i stored the gridview1 Data's and textedits to Access Database. In another form i Bind some column to gridview1 and TextEdits to new Gridview (gridview2). Now if i click edit button on any row in the gridview2, I want to get the Data's from Access Database and shown in 1st Form gridview1 and textedits fill automatically recording to Focused Row cell unique value.

Using this code i get value to TextEdits Fields

C#
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/Srihari/OrionSystem.accdb");

        OleDbCommand da = new OleDbCommand("select * from invoice_top where invoice_number=" + textEdit5.Text, con);
        con.Open();
        OleDbDataReader reader = da.ExecuteReader();
        while (reader.Read())
        {
            textEdit12.Text = reader.GetValue(1).ToString();
            textEdit13.Text = reader.GetValue(2).ToString();
            textEdit4.Text = reader.GetString(3);
            dateEdit1.Text = reader.GetValue(8).ToString();
            textEdit1.Text = reader.GetValue(5).ToString();
            textEdit2.Text = reader.GetValue(6).ToString();
            textEdit3.Text = reader.GetValue(7).ToString();
            checkEdit1.Checked = reader.GetBoolean(4);
         }

        con.Close();


I also want to fill gridview Data's ? I tried this bus its not working
C#
gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[2], reader1.GetString(2));

How to set Access Database values to grdiview ?? Please Help me

Thanks in Advance
Srihari
Posted
Updated 8-Nov-13 22:59pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900