What's likely wrong:
* Incorrectly wired hot wire: You've likely connected the hot wire from the outlet to the traveler wire (the wire that carries power to the light switch). This means the outlet is only getting power when the switch is open (off).
* Missing neutral wire: If you only have two wires coming from the switch box, you're missing a neutral wire. You need a neutral wire to complete the circuit for the outlet to work properly.
What you need to do:
1. Safety First: Turn off the power to the circuit at the breaker box. Always double-check that the power is off using a voltage tester.
2. Identify the Wires: Use a voltage tester to identify the hot, neutral, and ground wires in the switch box and outlet box.
3. Correct the Wiring:
* If you have a neutral wire available: Connect the neutral wire from the outlet to the neutral wire in the switch box.
* If you don't have a neutral wire: You'll need to run a new neutral wire from the outlet box back to the junction box or electrical panel. This will require opening up walls and potentially some electrical knowledge.
4. Connect the Hot Wire: Connect the hot wire from the outlet to the hot wire in the switch box, not the traveler wire.
5. Ground Wire: Connect the ground wire from the outlet to the ground wire in the switch box.
6. Test: Turn on the power at the breaker box and test the outlet to ensure it's working properly.
Important Notes:
* Electrical Work is Dangerous: If you're not comfortable working with electrical wiring, do not attempt this yourself. Contact a licensed electrician. They can diagnose the problem and safely fix the wiring.
* Codes and Regulations: Always ensure your work meets local electrical codes and regulations.
If you have any further questions or need more clarification, please ask!