I am 19 weeks pregnant and have a stomach bug

I am 19 weeks pregnant and have a stomach bug. When I eat something, I get terrible cramps about an hour later and then it comes out in diarrhea.  This is the third day.  Can a stomach bug cause harm to the babies?