Answer the question
In order to leave comments, you need to log in
How to make event in wpf asynchronous?
I have this kind of code. The function itself
static public List<string> GetData(string NameBase,string Row,string type = "0")
List<string> data = new List<string>();
SQLiteConnection conn = new SQLiteConnection(@"Data Source=Zhur-Test.db"); ;
conn.Open();
string IdBases = "FullBases";
string sql1 = "select Id,NameTable from ListTable where FullName = '" + NameBase + "'";
SQLiteCommand cmd1 = new SQLiteCommand(sql1, conn);
SQLiteDataReader reader1 = cmd1.ExecuteReader();
while (reader1.Read())
{
IdBases = Convert.ToString(reader1["NameTable"]);
}
string sql = "select distinct " + Row + " from " + IdBases;
SQLiteCommand cmd = new SQLiteCommand(sql, conn);
SQLiteDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
if (type == "0")
{
data.Add(Convert.ToString(reader[Row]));
}
else
{
var b1 = Regex.Split(Convert.ToString(reader[Row]), ";");
for (int i = 0; i < b1.Length; i++)
{
data.Add(Convert.ToString(b1[i]));
}
}
}
conn.Close();
return data;
}
}
private void OuterListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
object item = ListJournal.SelectedItem;
if (item == null)
{
}
else
{
ListJournal.Text = item.ToString();
NameVicon1.ItemsSource = Func.GetData(ListJournal.Text, "NameVicon1", "1").Distinct();
Koresp.ItemsSource = Func.GetData(ListJournal.Text, "Koresp").Distinct();
Resolution.ItemsSource = Func.GetData(ListJournal.Text, "Resolution").Distinct();
KrtZmist.ItemsSource = Func.GetData(ListJournal.Text, "KrtZmist").Distinct();
NomerStr.ItemsSource = Func.GetData(ListJournal.Text, "NomerStr","1").Distinct();
}
}
Answer the question
In order to leave comments, you need to log in
Did the standard methods work?
https://docs.microsoft.com/en-us/dotnet/csharp/pro...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question