public void addProperty(Address address, String[] details) { dc.ExecuteNonQuery("insert into Property(PropertyType, Cost, Available, AgentID) values ('" + details[0] + "', " + details[1] + ", 1, " + details[2] + ");"); DataTable idResult = dc.ExecuteQuery("select PropertyID from Property where AgentId = " + details[2] + " ORDER BY PropertyID DESC;"); String id = idResult.Rows[0].ItemArray[0].ToString(); dc.ExecuteNonQuery("insert into Address values (" + id + ", " + address.StreetNo() + ", '" + address.StreetName() + "', '" + address.Suburb() + "', " + address.PostCode() + ", '" + address.State() + "', '" + address.Country() + "');"); refresh(); }