public GUIhosts(GUImain gui, SqliteConnection connection) { InitializeComponent(); InitializeList(); this.gui = gui; _connection = connection; using (SqliteCommand command = new SqliteCommand("SELECT host, port, password FROM hosts ORDER BY id DESC", _connection)) { using (SqliteDataReader reader = command.ExecuteReader()) { while (reader.Read()) { String host = gui.GetSafeString(reader, 0); String port = gui.GetSafeString(reader, 1); String password = gui.GetSafeString(reader, 2); String[] items = { host, port, password }; ListViewItem item = new ListViewItem(items); list.Items.Add(item); } } } }
public GUIhosts(GUImain gui, SqliteConnection connection, SqliteCommand command) { InitializeComponent(); InitializeList(); this.gui = gui; _connection = connection; _command = command; using (_command = new SqliteCommand("SELECT host, port, password FROM hosts ORDER BY id DESC", _connection)) { using (SqliteDataReader reader = _command.ExecuteReader()) { while (reader.Read()) { String host = gui.GetSafeString(reader, 0); String port = gui.GetSafeString(reader, 1); String password = gui.GetSafeString(reader, 2); String[] items = { host, port, password }; ListViewItem item = new ListViewItem(items); list.Items.Add(item); } } } }
public void Comment(GUImain gui, SqliteConnection connection, String name, String guid, String mode) { this.gui = gui; this.connection = connection; this.Text = "Comment " + name; this.guid = guid; this.mode = mode; SqliteCommand command = new SqliteCommand(connection); command.CommandText = "SELECT comment FROM comments WHERE guid = @guid"; command.Parameters.Add(new SqliteParameter("@guid", guid)); SqliteDataReader reader = command.ExecuteReader(); if (reader.Read()) input.Text = gui.GetSafeString(reader, 0); reader.Close(); reader.Dispose(); command.Dispose(); }
public void Comment(GUImain gui, SqliteConnection connection, String name, String guid, String mode) { this.gui = gui; this.connection = connection; this.Text = "Comment " + name; this.guid = guid; this.mode = mode; SqliteCommand command = new SqliteCommand(connection); command.CommandText = "SELECT comment FROM comments WHERE guid = @guid"; command.Parameters.Add(new SqliteParameter("@guid", guid)); SqliteDataReader reader = command.ExecuteReader(); if (reader.Read()) { input.Text = gui.GetSafeString(reader, 0); } reader.Close(); reader.Dispose(); command.Dispose(); }