Best guess? Does your DataSet contain a Table called "tbl_permits"? Or did you spell it wrong?
Alternatively, have you got a DataSet in dsCompanies?
Put a breakpoint on the line and check.
Mind you, I suspect that code isn't real: The ToString should probably be a method call:
txtRecordCount.Text = FormatNumber(Rcount.ToString(), 0)