Сразу говорю, в C# я ноль, укажите на проблему и как её исправить.
private void CForm_Load(object sender, EventArgs e)
{
DB = new SQLiteConnection("Data Source=C:/Users/User/Desktop/greem.db");
DB.Open();
ThreadStart lschat = new ThreadStart(Listing);
Thread thread = new Thread(lschat);
thread.Start();
}
private void ListingChat()
{
SQLiteCommand CMD = DB.CreateCommand();
while (true)
{
CMD.CommandText = "SELECT * FROM messages";
SQLiteDataReader SQL = CMD.ExecuteReader();
if (SQL.HasRows)
{
while (SQL.Read())
{
string namepc = "" + SQL["name"] + "";
if (namepc != "Admin")
{
string[] csg = { "[YOU] " + SQL["msg"] + "" };
listBox1.Items.AddRange(csg);
}
else
{
string[] csg = { "► " + SQL["msg"] + "" };
listBox1.Items.AddRange(csg);
}
}
}
else
{
string[] csg = { "NON DATA" };
listBox1.Items.AddRange(csg);
}
}
}