I think you need to learn
ADO.net[
^] concepts to perform CRUD operations. You can read this article as well:
Using ADO.NET for beginners[
^]
And yes you can use a separate class file for connection, but I would prefer to use Web.config file to write the connection strings as it is in XML form and can be edited after published code.
hope it helps :)