The list will grow and shrink depending on the number of items that I have in my database.
I need to fill out a list, not a list. I understand that I will need to open a connection.
using (var conn = new SqlConnection(Properties.Settings.Default.DBConnectionString))
{
using (var cmd = conn.CreateCommand())
{
conn.Open();
List<string> TagList = new List<string>();
for (int i = 0; i < TagList.Count; i++)
TagList[i].Add("Data from database");
cmd.ExecuteNonQuery();
}
}
I'm really not sure how to do this, and I'm sure my method here looks very wrong, so I really need help.
Can someone show me what I'm doing wrong?
source
share