private void sbsave_Click(object sender, System.EventArgs e) { try { if (teip.Text.Trim() == "" || teport.Text.Trim() == "" || tecase.Text.Trim() == "" || teusername.Text.Trim() == "" || tepassword.Text.Trim() == "") { MessageShow("连接字符有误!"); return; } if (!PublicClass.Ping(teip.Text.Trim())) { MessageShow("IP地址无法ping通,请确认,或直接修改配置文件!"); return; } string connectionstring = string.Format(connection, teip.Text.Trim(), teport.Text.Trim(), tecase.Text.Trim(), teusername.Text.Trim(), tepassword.Text.Trim()); PublicClass.ConnectionStringsAdd("EMRDB", connectionstring, "System.Data.OracleClient"); MessageShow("配置信息保存成功!"); this.Close(); } catch (Exception ex) { MessageShow(ex.Message); } }