How can I connect R with visual studio to build web application

Is there a way to build web application with R connected to visual studio and sql server?

I think you can use visual studio as your IDE if you want. There is an extension of VS for that as well that ease the experience.

You can use shiny as your web framework without a doubt.

For database connection, see db.rstudio.com you will find all the info on how to connect to a database.

For a web application with shiny the Ë‹pool` :package: is recommended
https://shiny.rstudio.com/articles/pool-basics.html

Is this the kind of info you are looking for?