Hi!!!
I have a gridView on the form in my windows application and in the database I have a table "student" having fields " c_id,sec_id,sub_id,s_id,s_name". On button click(Add) I am executing the query for saving data to database.
In gridView there are 3 column headers namely- "Roll No", "Student Name", "Marks".
Firstly , I want that when I click on button(Add) ,then "s_id" should display in "RollNo" column , "s_name" should display in "Student Name" column and "Marks column" should be editable in gridview.
Secondly, how can I add marks in Marks column in datagrid during runtime and those marks should save in table named "result" having one of the column as "marks" column.


I hope my problem is clear.
Kindly give some solution...........:pretty:

>"s_id" should display in "RollNo" column ..should be editable in gridview.

Customize Columns collection. (ie. Adds three columns programatically or have a DataTable with three columns)

>how can I add marks in Marks column in datagrid during runtime and those marks should save in table named "result" having one of the column as "marks" column.

Create a datatable instance

DataTable dt=new DataTable();
dt.Columns.Add("Roll",typeof(int));
dt.Columns.Add("Name");
dt.Columns.Add("Marks");

Add button's click handler to write/update each row of dataTable into database table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.