Hey there, =)
My head is almost through with my database im working on. I just need one more thing i Cant seem to do.
Now this is my code for connecting to my datagridview
String connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Resources\\db1.mdb";
string query = "SELECT * FROM Expenditure";
//create an OleDbDataAdapter to execute the query
dAdapter = new OleDbDataAdapter(query, connString);
//create a command builder
OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(dAdapter);
//fill the DataTable
dAdapter.Fill(dTable);
//the DataGridView
DataGridView dgView = new DataGridView();
//BindingSource to sync DataTable and DataGridView
BindingSource bSource = new BindingSource();
//set the BindingSource DataSource
bSource.DataSource = dTable;
//set the DataGridView DataSource
tblAllEntries.DataSource = bSource;
Now i have a column called "The Expense" and "Amount". I have already created a variable called Total to calculate the sum of all the integers in the total column. NOW i want to create a row Right at the bottom of the datagridview with the total amount. In other words i want it to look like this
"The Expense"..........."Amount"
Car........................600
House......................900
food.......................200
movies.....................100
Total......................1800
How would i insert that row programmatically. I already have the code worked out to get the total row to create itself at the bottom of everything no matter how much expenses are added or deleted.
Thank you =)
Ruan