using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Tset { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //string b="1"; //string c="1"; //string d="1"; //string f="1"; //string g="1"; //string h="1"; string sServer = ""; string sDataBase =""; string sUser =""; string sPassword = ""; //string a = "select HWHID,HSPID,HQty,HSumQtyMust,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo from Kf_ICInventory_FIFO_Tmp where HInterID=" + b.ToString() + " and HBillType='" + c + "' and HKFDate='" + d + "' and HMaterID='" + f + "'and HSPID=" + g + " and HBatchNo= '" + h + "'"; //string j = "0"; string connString = "server=.;database=HX_LimsSys;uid=HX_User;password=lc@841022 providerName=System.Data.SqlClient"; // string[] sArray = connString.Split(new char[3] { 'j', '_' }); string[] sArray = connString.Split(new string[] { "=", ";"," " }, StringSplitOptions.RemoveEmptyEntries); sServer = sArray[1].ToString(); sDataBase = sArray[3].ToString(); sUser = sArray[5].ToString(); sPassword = sArray[7].ToString(); MessageBox.Show(sServer); MessageBox.Show(sDataBase); MessageBox.Show(sUser); MessageBox.Show(sPassword); } } }