public void selectData(List<String> where1, List<String> where2, String tableName, String[] orderBy)
{
command.CommandText = "SELECT * from ";
command.CommandText += tableName;
if (where1.Count > 0)
{
command.CommandText += " WHERE";
for (int i = 0; i < where1.Count; i++)
{
command.CommandText += " " + where1.ElementAt(i) + "=" + where2.ElementAt(i) + " AND";
}
command.CommandText = command.CommandText.Substring(0, command.CommandText.Length - 3);
where1.RemoveRange(0, where1.Count);
where2.RemoveRange(0, where2.Count);
}
command.CommandText += " ORDER BY ";
command.CommandText += orderBy;
dataReader = command.ExecuteReader();
while (dataReader.Read())
{
Console.WriteLine("ID : " + DB_PrintToConsole(dataReader, 0) + " ");
Console.WriteLine("Source Site : " + DB_PrintToConsole(dataReader, 1) + " ");
Console.WriteLine("Source ID : " + DB_PrintToConsole(dataReader, 2) + " ");
Console.WriteLine("Circle Name : " + DB_PrintToConsole(dataReader, 3) + " ");
Console.WriteLine("Date : " + DB_PrintToConsole(dataReader, 4) + " ");
Console.WriteLine("Title : " + DB_PrintToConsole(dataReader, 5) + " ");
Console.WriteLine("Title Altern : " + DB_PrintToConsole(dataReader, 6) + " ");
Console.WriteLine("Language : " + DB_PrintToConsole(dataReader, 7) + " ");
Console.WriteLine("Data Type : " + DB_PrintToConsole(dataReader, 8));
Console.WriteLine();
}
}