The error in your where clause is because of this
string str = "select m.pcode,m.fyyear,m.date,m.salary,m.ta,m.contigency,m.nrc,m.institcharges,m.others,p.total from monthly m inner join project p where m.pcode="+DropDownList1.SelectedItem.Value.ToString()+"on p.pcode=m.pcode";
You need to change
="+DropDownList1.SelectedItem.Value.ToString()+"on
to
='"+DropDownList1.SelectedItem.Value.ToString()+"' on
Code Fixed:
string str = "select m.pcode,m.fyyear,m.date,m.salary,m.ta,m.contigency,m.nrc,m.institcharges,m.others,p.total from monthly m inner join project p where m.pcode='"+DropDownList1.SelectedItem.Value.ToString()+"' on p.pcode=m.pcode";
Corrected SQL
string.Format(@"select m.pcode, m.fyyear, m.date, m.salary, m.ta, m.contigency, m.nrc, m.institcharges, m.others, p.total FROM monthly AS m inner join project p on p.pcode=m.pcode where m.pcode = '{0}'", DropDownList1.SelectedItem.Value.ToString());
Obviously i dont have access to your database/ability to run this query but from eyeballing it and according to your error message you specified this is likely to be your cause.