Exemplo n.º 1
0
        public void LoadSource(LogSource source)
        {
            _source = source;

            Text = source.Name;

            _conn = new DataConnection
                        {
                            Host = _source.Server.Host,
                            Username = _source.Server.Username,
                            Password = _source.Server.Password,
                            Database = _source.Database,
                            Table = _source.Table
                        };
            _conn.Open();

            RefreshLogView();

            _refreshTimer.Start();
        }
Exemplo n.º 2
0
        private void RefreshTableList()
        {
            var databaseName = (string) ddlSourceDatabase.SelectedItem;
            var server = (Server) ddlSourceServer.SelectedItem;
            if (server != null && !string.IsNullOrEmpty(databaseName))
            {
                using (var db = new DataConnection
                                    {
                                        Host = server.Host,
                                        Username = server.Username,
                                        Password = server.Password,
                                        Database = databaseName
                                    })
                {
                    try
                    {
                        db.Open();

                        ddlSourceTable.DataSource = null;
                        ddlSourceTable.DataSource = db.GetTables();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, string.Format("Error connecting to server:\n{0}", ex.Message),
                                        "Unable To Connect", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
        }