It happened to me just now. I thought at first it was my SD Card that was infected, so, I scanned it and even reformatted it, then it was okay. But when I inserted it to my DSLR, and took some shots, again, all the pictures were gone. So I decided to insert the SD card back to my laptop. My antivirus detected a worm on my memory card again. My fear was confirmed when I directly connected my DSLR to the computer. Is it okay to scan my DSLR with the antivirus?
It is likely that your computer is infected with a worm that automatically copies itself to removable media to try and spread. When you format the card, it may be briefly clean, but it would rapidly get reinfected by the worm. It is possible the worm only uploads itself to the card when inserted in the computer.
Try formatting the card, if virus scan then says it is clean, try ejecting it and simply plug it back in to the computer and see if it is still clean. Most likely it will not be clean after this reinsert.
It is theoretically possible for someone to write a virus that could infect a camera and try to worm on to other hosts via a memory card, but such a virus would be very VERY specialized and very elaborate. There is very little reason such a virus would be used in the wild unless it was trying to attack some kind of secure environment through a camera, so it is highly unlikely you have a virus on your camera.
Just as a biological virus can't infect hosts that are very different from one another, a computer virus typically only infects a certain type of host (PC, Mac, Linux, etc.). It's very unlikely that the virus has actually infected your DSLR.
What you're probably seeing, though, is that the SD card is a carrier. You mentioned that you connected the DSLR to your computer, but if the infected SD card was still in the camera, you're just detecting the worm still on the same card. Try connecting the camera to your computer without the SD card in it and see if that makes any difference.
Next, when you format the card, you're probably performing a "quick format", which doesn't really do much at all. You're going to want to do a low-level format -- if you're using Windows, you should be able to right-click on the drive for the SD card and choose "format" -- make sure the "quick format" option is unchecked. Your anti-virus software should also give you an option to clean the card.