In-network data storage and retrieval is one of the most important problems in wireless sensor networks. Many schemes have been proposed to solve this problem. However, most of them do not take the frequencies of event and query into consideration. In fact, the frequencies of event and query are very important factors in real applications of in-network data storage and retrieval. In this paper, we introduce a virtual-ring-based data storage and retrieval scheme, which is called VRS, to solve the problem. VRS divides the whole sensor network field into some virtual rings. According to the frequencies, one of the virtual rings is selected out as the rendezvous ring, which plays the role of a bridge between the information consumers and the information producers. Extensive experiments have been done to evaluate the performance of the proposed scheme, VRS. Simulation results show that VRS outperforms the existing work in load balance, delay of data storage and retrieval, and the lifetime of the sensor networks.