Just change your sql statement to
sql = "Select studid,s.Bfid,Rate,class from student s left outer join Batch b on s.Bfid=b.Bfid";
I've used
left outer join
in case you have student records that do not have Batch records. If you only want to list students that do have a Batch record then change it to
inner join
Also note that I've had to specify
s.Bfid
in the select clause because the column Bfid appears on both tables. Just using Bfid leads to an ambiguity error.