Hi,
I have (well, HAD) a very nice large vegetable garden . . . I had everything in there, until the dogs decided it would be a fun little race track. So I fenced it in . . . well, its not tall enough and the dogs leap effortlessly over the fence.
Everytime I see them in there, I tell them NO! and they leap right out . . . the trouble as I'm sure you can imagine is the timing . . . I never catch them in the act of going INTO the garden so correction is difficult. If I'm outside with them, they won't go in there, and I can't watch from the house. The other trouble is that going in the garden is reinforcing as they eat the vegetables. These dogs have a large yard otherwise and get plenty of intense exercise so its not an issue of excess energy.
I've considered an e-collar, but I'm not really into that approach. Anyone ever tried the "scarecrow motion activated sprinkler"? Neither of my dogs like the sprinkler and this IMO is a more humane deterrent.