This is directly from Nintendo:
Error Code: 51031
The only wireless network within range of your Wii console is not configured or is not compatible with the Wii.
Check for interference that may be preventing a successful connection. Click here for tips.
Check to see if the router you are using is a known to be incompatible. Click here to view our list. If your router is known to be incompatible, we recommend using a different router if possible.
Make sure that the SSID (network name) matches exactly to what you have entered in the Wii console's settings. To verify:
Login to your router's settings (click here and select your router, if available, for information).
Look for the section for SSID (typically in the "wireless settings" area).
After you find the SSID (network name), verify in the manual settings of the Wii console that the SSID appears exactly as listed in the consumer's router. This includes making sure capitalization, spaces, or special characters match exactly.
Look up your router, if available, in our list of wireless routers, and check for any special notes that may be necesary to get the connection to work properly.
The router may not be assigning an IP address to the Wii console, and a connection using the "Manual Settings" may be necessary. Click here for help.
Your router may require a firmware update to work properly with the Wii console. Firmware updates can usually be found on the router manufactruer's website; consult the manufacturer for more information.
If the problem persists, try our general troubleshooting steps.
Click on the link to be able to get more details. Hope this helps! :)