"Column 'Pid' does not belong to table Table."
This is because you are trying to access a value from retrieved table row assuming you have a column named 'Pid' in the row, here:
ds.Tables[0].Rows[0]["Pid"].ToString();
Check your query and make sure you have a column named 'Pid' returned.