lign="justify"> lt;/MenuItem gt;  
 lt; MenuItem Header= З'єднання gt; 
  lt; MenuItem Name= connBtn Header= Підключитися Click= connBtn_Click gt; lt;/MenuItem gt; 
  lt; MenuItem Name= disconnBtn Header= Отключиться IsEnabled= False Click= disconnBtn_Click gt; lt;/MenuItem gt; 
  lt;/MenuItem gt; 
  lt;/Menu gt; 
  lt; ComboBox Height= 23 HorizontalAlignment= Left Margin= 608,0,0,0 Name= selectDB VerticalAlignment= Top Width= 170 SelectionChanged= selectDB_SelectionChanged IsEnabled= False / gt; 
  lt; Label Content= Вибіріте таблицю: Height= 23 HorizontalAlignment= Left Margin= 494,0,0,0 Name= label1 VerticalAlignment= Top / gt; 
  lt;/Grid gt; 
  lt;/Window gt; 
    8.1.2Файл вихідного коду MainWindow. xaml. cs  
  using System; System. Collections. Generic; System. Linq; System. Text; System. Windows; System. Windows. Controls; System. Windows. Data; System. Windows. Documents; System. Windows. Input; System. Windows. Media; System. Windows. Media. Imaging; System. Windows. Navigation; System. Windows. Shapes; System. Data; System. Data. SqlClient; Microsoft. VisualBasic; System. Transactions; System. IO; System. Threading; Microsoft. SqlServer. Managementmon; Microsoft. SqlServer. Management. Smo; Microsoft. SqlServer. Management. Sdk. Sfc; Microsoft. SqlServer. Server; Motherboard 
  {
  /// lt; summary gt; 
  ///Логіка взаємодії для MainWindow. xaml 
  /// lt;/summary gt; partial class MainWindow: Window 
  {MainWindow () 
  {(); 
 } 
 /* Оголошуємо строкову змінну і записуємо в неї 
  рядок подключеніяSource - ім'я сервера, за стандартом (local) 
  Initial Catalog - ім'я БДSecurity=-параметри безпеки 
  */void exitBtn_Click (object sender, RoutedEventArgs e) 
  {(); 
 } static string connStr=@ Data Source=(local); + 
  Initial Catalog=DB_motherboard; + 
				
				
				
				
			  Integrated Security=True; raquo ;; void connBtn_Click (object sender, RoutedEventArgs e) 
  {ConnectionToDB=new SqlConnection (connStr); 
  {. Open (); 
 } (SqlException se) 
  {
 //messageBox. Content=se. Message ;. Close () ;. Dispose ();=new SqlConnection (@ Server=(local); Integrated Security=True; ); cmd=new SqlCommand ( RESTORE DATABASE DB_motherboard FROM DISK= + System. IO. Path. GetDirectoryName (System. Reflection. Assembly. GetExecutingAssembly (). Location) + /DB_motherboard. bak WITH REPLACE 
 , ConnectionToDB) ;. Open () ;. ExecuteNonQuery () ;. Sleep (10000) ;. Close () ;. Dispose ();=new SqlConnection (connStr) ;. Open (); 
 //return; 
 } 
  {. Content= Підключення до БД успішно пройшло raquo ;;. IsEnabled=true ;. IsEnabled=false ;. IsEnabled=true ;. IsEnabled=true ;. IsEnabled=true; Btn. IsEnabled=true; Btn. IsEnabled=true; Btn. IsEnabled=true ;. IsEnabled=true ;. IsEnabled=true; dt=ConnectionToDB. GetSchema ( Tables ) ;. Items. Clear (); (DataRow item in dt. Rows) 
  {TableName=item [ TABLE_NAME ]. ToString () ;. Items. Add (TableName); 
 }. Items. RemoveAt (0) ;. SelectedIndex=0 ;. Close () ;. Dispose (); 
 } 
 } void disconnBtn_Click (object sender, RoutedEventArgs e) 
  {ConnectionToDB=new SqlConnection (connStr); 
  {. Close () ;. Dispose (); 
 } (SqlException se) 
  {. Content=se. Message ;; 
 } 
  {. IsEnabled=false ;. IsEnabled=true ;. IsEnabled=false ;. IsEnabled=false ;. IsEnabled=false; Btn. IsEnabled=false; Btn. IsEnabled=false; Btn. IsEnabled=false ;. IsEnabled=false ;. IsEnabled=false ;. Content= Відключення від БД успішно пройшло raquo ;; 
 } 
 } void addBtn_Click (object sender, RoutedEventArgs e) 
  {tableName=selectDB. SelectedValue. ToString (); 
 //відкриваємо нове вікно 
  (new add (tableName)). Show (); 
 } void rmwBtn_Click (object sender, RoutedEventArgs e)