Please try the below mentioned steps and check if this helps:
1. Check in the BIOS (System Setup) if the Optical Drive (CD/DVD Drive) is detected and is enabled. For steps on how to get to BIOS and make changes refer to the User's Manual of the Motherboard or the system.
2. If the Optical Drive is not shown in the BIOS, load BIOS defaults (or Optimized Settings).
3. If the Optical Drive is still not detected in the BIOS, reseat the Optical Drive Data Cable and Power Cable. (Note: Before this step is performed remove any power connections and external devices, safely remove the chassis cover and locate the Optical Drive).
4. If the Optical Drive is still not detected, try a different Optical Drive Data Cable (you can use the one from the Hard Drive, if the cables are same).
5. If there are no results yet, connect the Optical drive to a different port on the motherboard.
6. After performing steps 1 through 5, if the Optical Drive is not detected replace the Optical Drive.
Note: if you are not comfortable opening the computer chassis, take a technician's help.
7. If the Optical Drive is detected in the BIOS but not in Windows, run the below mentioned fix from Microsoft:
8. If the Optical Drive is still not detected in Windows only, update the latest firmware for the Optical Drive. You can find the latest firmware on your computer manufacturer's website, drivers CD or from the Optical Drive manufacturer's website.
9. If still the Optical Drive is not detected in Windows only, Restore your computer to an earlier date (http://windows.microsoft.com/en-US/windows-vista/Turn-back-time-on-your-PC-Undo-system-changes-with-System-Restore
10. If the issue is still not fixed, do an Operating System Reinstallation.
Do reply with results.