It really depends on the type and size of the file. If it's a text file, then you could use File.ReadAllText()
to get a string that you can save in your database.
If it's not a text file, then you could use File.ReadAllBytes()
to get the file's binary data, and then save that to your database.
Be careful though, databases are not a great way to store heavy files (you'll run into some performance issues).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…