private void Connect_Btn_Click(object sender, EventArgs e) { string connectionString = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};", Server_cmbBox.Text, Database_TxtBox.Text, Username_TxtBox.Text, Password_TxtBox.Text); try { SqlHelper helper = new SqlHelper(connectionString); if (helper.IsConnection) { StartForm.showBalloon("Sql Connection", "connection succeeded..."); StartForm.ConnectionString_main = connectionString; connectionString = string.Format("metadata=res://*/myModel.csdl|res://*/myModel.ssdl|res://*/myModel.msl;provider=System.Data.SqlClient;provider connection string="data source={0};initial catalog={1};persist security info=True;user id={2};password={3};MultipleActiveResultSets=True;App=EntityFramework"", Server_cmbBox.Text, Database_TxtBox.Text, Username_TxtBox.Text, Password_TxtBox.Text); AppSetting setting = new AppSetting(); string apps = setting.GetConnectionString("EmployeeCardentities"); setting.SaveConnectionString("EmployeeCardentities", connectionString); StartForm.showBalloon("App Config", "Your connection string has been successfully saved."); apps = setting.GetConnectionString("EmployeeCardentities"); this.Hide(); pass form = new pass(); form.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 设定规格用 /// </summary> /// 需要加密码 private void changeSpec_Click(object sender, RoutedEventArgs e) { button.IsEnabled = false; Save.IsEnabled = true; pass pas = new pass(); pas.ShowDialog(); Keyboard.ClearFocus(); //规格可变化时界面变更 for (int i = 0; i < spectable.Rows.Count; i++) { specList[i].IsReadOnly = false; specList[i].Background = new SolidColorBrush(Colors.White); } }
public tw_main getSelectedValue(pass the parameters required by the method)