This article shows how to use ADO
ADO Database Access with C++
http://www.experts-exchange.com/A_1244.html
If you are using MFC, its actually quite a bit easier. Just create a CDatabase object:
http://msdn.microsoft.com/en-us/library/hbftwssy(VS.80).aspx
...and execure this SQL statement:
SELECT COUNT(*) FROM customers WHERE ip_addr= (put ip address here)
A non-zero return indicates that at least one match was found.