My problem: I need to update the database in my program. The database I'm updating from is stored on a FTP server.
What I know: I already know how to download the file from the FTP server. I'm doing that like this:
string locFileName = Path.GetTempPath() + Path.GetFileNameWithoutExtension(Path.GetTempFileName()) + ".db3";
string ftpFileName = host + @"database/db_SuperiorOrderForm.db3";
using (WebClient request = new WebClient())
{
request.Credentials = new NetworkCredential(user, pass);
byte[] fileData = request.DownloadData(ftpFileName);
using (FileStream file = File.Create(locFileName))
{
file.Write(fileData, 0, fileData.Length);
}
}
To do the actual updating I was thinking I would wipe the local database, load the downloaded database into a List
(like this question) and then load the new data back into the local database
However, I got the impression from the comment by @Dan Tao under the previous link and this post that using a List
or Array
would be bad. Could someone explain why? Also, what would be a better way to do what I'm asking?
I'm still fairly new to c#, so I'm trying to figure out all the best practices, but I want to do everything properly. If there's anything unclear in this question, please let me know before down-voting. Thanks in advance!