Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //SettingsWindow.xaml.cs
- private void connectBtn_Click(object sender, RoutedEventArgs e)
- {
- string dbInstance = dbInstBox.Text;
- string dbName = dbNameBox.Text;
- string username = userBox.Text;
- string password = passBox.Text;
- DB = dbInstance;
- using (
- SqlConnection myConn =
- new SqlConnection(String.Format("Data Source={0};Integrated security=SSPI;database=master",
- dbInstance)))
- {
- try
- {
- myConn.Open();
- System.Windows.Forms.MessageBox.Show("Logged To DataBase Successfully", "MyProgram",
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- Server db = new Server(new ServerConnection(myConn));
- //str = SQLQueryGenerator.SQLQueryGenerator.GenerateCreateDBWithUserAndPass(dbName, username, password);
- }
- catch (System.Exception ex)
- {
- System.Windows.Forms.MessageBox.Show(ex.ToString(), "MyProgram", MessageBoxButtons.OK,
- MessageBoxIcon.Information);
- }
- finally
- {
- if (myConn.State == ConnectionState.Open)
- {
- myConn.Close();
- }
- var mW = new MainWindow(DB, dbName);
- mW.ShowDialog();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement