Usually you'd create a data access layer class that contains all the data access methods with the sql code. Another way to separate the SQL from the .NET code is to use stored procedure. Then the .NET side of things is a little simpler and you also get performance gains by having compiled procedures on the database side.
-
Peter