예제 #1
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            SQLInformation.Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter ta = new SQLInformation.Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter();

            ta.Connection.ConnectionString = SQLInformation.Data.Config.SQLMonitorDBConnection;

            ta.Update(Common.ApplicationDataSet.DBTables);
        }
예제 #2
0
        private void LoadTables(string instanceName, SQLInformation.Data.ApplicationDataSet.DatabasesRow databaseRow)
        {
#if TRACE
            //long startTicks = Common.WriteToDebugWindow(string.Format("Enter {0}:{1}()", TYPE_NAME, System.Reflection.MethodInfo.GetCurrentMethod().Name));
#endif

            SMO.Server server = SMOH.SMOD.GetServer(instanceName);

            SQLInformation.Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter tableAdapter = new SQLInformation.Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter();
            tableAdapter.Connection.ConnectionString = SQLInformation.Data.Config.SQLMonitorDBConnection;

            int dbID = databaseRow.ID_DB;

            SMO.Database db = server.Databases.ItemById(dbID);

            foreach (SMO.Table table in db.Tables)
            {
                SMOH.Table tableH = new SMOH.Table(table);

                SQLInformation.Data.ApplicationDataSet.DBTablesRow newTable = Common.ApplicationDataSet.DBTables.NewDBTablesRow();

                newTable.ID            = Guid.NewGuid(); // See if this is available from table.
                newTable.Name_Table    = tableH.Name;
                newTable.Table_ID      = tableH.ID;
                newTable.Database_ID   = databaseRow.ID; // From above
                newTable.Owner         = tableH.Owner;
                newTable.CreateDate    = DateTime.Parse(tableH.CreateDate);
                newTable.DataSpaceUsed = int.Parse(tableH.DataSpaceUsed);

                try
                {
                    newTable.DateLastModified = DateTime.Parse(tableH.DateLastModified);
                }
                catch (Exception ex)
                {
                }

                newTable.RowCount = int.Parse(tableH.RowCount);

                Common.ApplicationDataSet.DBTables.AddDBTablesRow(newTable);
                tableAdapter.Update(Common.ApplicationDataSet.DBTables);
            }
#if TRACE
            //Common.WriteToDebugWindow(string.Format("Exit {0}:{1}()", TYPE_NAME, System.Reflection.MethodInfo.GetCurrentMethod().Name), startTicks);
#endif
        }
예제 #3
0
 private void Window_Loaded_1(object sender, RoutedEventArgs e)
 {
     SQLInformation.Data.ApplicationDataSet applicationDataSet = ((SQLInformation.Data.ApplicationDataSet)(this.FindResource("applicationDataSet")));
     // Load data into the table Servers. You can modify this code as needed.
     SQLInformation.Data.ApplicationDataSetTableAdapters.ServersTableAdapter applicationDataSetServersTableAdapter = new SQLInformation.Data.ApplicationDataSetTableAdapters.ServersTableAdapter();
     applicationDataSetServersTableAdapter.Fill(applicationDataSet.Servers);
     System.Windows.Data.CollectionViewSource serversViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("serversViewSource")));
     serversViewSource.View.MoveCurrentToFirst();
     // Load data into the table Instances. You can modify this code as needed.
     SQLInformation.Data.ApplicationDataSetTableAdapters.InstancesTableAdapter applicationDataSetInstancesTableAdapter = new SQLInformation.Data.ApplicationDataSetTableAdapters.InstancesTableAdapter();
     applicationDataSetInstancesTableAdapter.Fill(applicationDataSet.Instances);
     System.Windows.Data.CollectionViewSource serversInstancesViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("serversInstancesViewSource")));
     serversInstancesViewSource.View.MoveCurrentToFirst();
     // Load data into the table Databases. You can modify this code as needed.
     SQLInformation.Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter applicationDataSetDatabasesTableAdapter = new SQLInformation.Data.ApplicationDataSetTableAdapters.DatabasesTableAdapter();
     applicationDataSetDatabasesTableAdapter.Fill(applicationDataSet.Databases);
     System.Windows.Data.CollectionViewSource serversInstancesDatabasesViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("serversInstancesDatabasesViewSource")));
     serversInstancesDatabasesViewSource.View.MoveCurrentToFirst();
     // Load data into the table DBTables. You can modify this code as needed.
     SQLInformation.Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter applicationDataSetDBTablesTableAdapter = new SQLInformation.Data.ApplicationDataSetTableAdapters.DBTablesTableAdapter();
     applicationDataSetDBTablesTableAdapter.Fill(applicationDataSet.DBTables);
     System.Windows.Data.CollectionViewSource serversInstancesDatabasesDBTablesViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("serversInstancesDatabasesDBTablesViewSource")));
     serversInstancesDatabasesDBTablesViewSource.View.MoveCurrentToFirst();
 }