Retriving Data,Perform Calculations and show those data
I am new to C#. I am working on a school result management system.I am taking result as input of a student in a table 'tblAddResult' where i have 7 column subject, january, february,march,marks, attendence, working_day.Now in datagrid view i want to show a column name average which is the average of january, february and march. and another column which is the 40% of marks column. I use method below for storing the data
public SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Nozibulla.Bashar\\documents\\visual studio 2010\\Projects\\School Result Management System\\School Result Management System\\SRMS.mdf;Integrated Security=True;User Instance=True");
public SqlCommand cmd;
cmd = new SqlCommand ("INSERT INTO tblAddResult (Subject, Janu, feb, march, Marks, [Working Day], Attendence) VALUES ('" + cbSubject.Text + "','" + tbJanu.Text + "','" + tbFeb.Text + "','" + tbMarch.Text + "','" + tbMarks.Text + "','" + tbWorkingDay.Text + "','" + tbAttendence.Text + "')", con); con.Open(); cmd.ExecuteNonQuery();