I need to count the number of records in an SQL database and compare it to a text file that contains a records number. Although I know how to access a SQL database in C#, I do not know how to count the number of records, or how to access the 2nd line of the count text file which contains "number of records: #####", and I need the ##### number to compare to the total number of records in the sql database.

Total number of rows in the database or in one particular table? The rows in a table can be returned with SELECT COUNT(*) FROM table_name.
Once you have loaded a file in a stream you can use the .readLine() function to move through the file. Then just split the string appropriately to extract the number you are after