Which means the DataView, dataw is Empty(the query returns no records) . So you have to Check for Empty before accessing the Value from it.
DataView dataw = new DataView(ReturnTable(gmyquery));
if (dataw!=null && dataw.Count > 0)
{
// Your code here
}