First of all, your question doesn't make any sense (at least not to me). You talk about opening files, but nowhere in that code are you opening a file (as in
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
string line;
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
You're selecting a database record.
Secondly, you don't need to include A.FileLoc, B.FileLoc, C.FileLoc, etc... in your Select. You're not using them at all.
Finally, I'm not sure how you're getting any information at all. You call
reader.Read()
twice. I assume that your database should only have one record for each file. So, here's what you are doing logically.
You set up your SQL Select.
You set up the SQLDataReader.
You execute the DataReader.
You read the first record.
You create firstname, lastname and fullname variables.
You read the next record.
*At this point you are already on the second record.
Now you fill in all of your TextBoxes.
If you are only expecting one row to be returned, you need to get rid of the
while(reader.Read())
.
And as an FYI, you are aware that instead of using memory to hold firstname, lastname and fullname, you could also just as easily write:
tbappname.Text = reader["Fname"].ToString() + " " + reader["Lname"].ToString();