12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using System.Data.SqlClient;
- using System.IO;
- namespace Practics
- {
- /// <summary>
- /// Interaction logic for DBRegistrationWindow.xaml
- /// </summary>
- public partial class DBRegistrationWindow : Window
- {
- //string connectionString = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=dbtechsphere;Integrated Security=True;Connect Timeout=30;Encrypt=False";
- //string currentDirectory = Directory.GetCurrentDirectory();
- //AttachDbFilename=C:\\Path\\To\\Database\\dbtechsphere.mdf
- public DBRegistrationWindow()
- {
- InitializeComponent();
- }
- private void btnDBConnect_Click(object sender, RoutedEventArgs e)
- {
- // string connectionString = "Data Source=(localdb)\\MSSQLLocalDB;AttachDbFilename="+currentDirectory+"\\dbtechsphere.mdf;Integrated Security=True;Connect Timeout=30;Encrypt=False";
- SqlConnection conn = new SqlConnection(Model.Model.connectionString);
- conn.Open();
- conn.Close();
- }
- }
- }
|