Emmy and Grammy-winning musician and songwriter Adam Schlesinger, known for his work with his band Fountains of Wayne and on the TV show “Crazy Ex-Girlfriend,” died Wednesday after contracting the coronavirus, his attorney said.

Schlesinger died at a hospital in upstate New York, his longtime lawyer Josh Grier told The Associated Press. It is not clear where or how Schelsinger, a 51-year-old father of two, contracted the virus. He had been sedated and on a ventilator for several days.

Schlesinger was nominated for 10 Emmys for writing comical songs across several television shows, winning three. He was nominated for an Academy Award for writing the title song to the 1997 Tom Hanks-directed movie “That Thing You Do.”

Raised in New York and Montclair, New Jersey, Schlesinger formed Fountains of Wayne, named for a lawn ornament store in Wayne, New Jersey, in 1995 with his classmate from Williams College Chris Collingwood.

With Schlesinger playing bass and singing backup and Collingwood playing guitar and singing lead, and the two men co-writing songs, the band known for its sunny harmonies and synthesis of pop, rock punk and comedy would have hits in 1996 with “Radiation Vibe” and 2003 with “Stacy’s Mom.” The latter was nominated for a Grammy.

Schlesinger would then drop behind the scenes and go on to be known for his writing.

He won the 2009 Grammy for best comedy album for writing the songs on “A Colbert Christmas: The Greatest Gift of All!” a companion to a TV Christmas special with songs performed by Stephen Colbert and Elvis Costello.

In recent years he was known along with the show’s star Rachel Bloom as one of the songwriters behind “Crazy Ex-Girlfriend,” the musical comedy series on the CW.

Last year, Schlesinger, Bloom and Jack Dolgen won an Emmy for the show’s song, “Antidepressants Are So Not A Big Deal.”

Schlesinger was divorced and had two daughters.