//XmlHandler xmlH = new XmlHandler(); /// <summary> /// 构造函数。 /// </summary> /// <param name="DatabaseConnectionString">数据库连接串</param> public Database() { //获取程序的基目录。 string str = XmlManage.ReadXml("IDLPath"); //System.Windows.Forms.MessageBox.Show(str); string sProPath = Application.StartupPath; //string sXmlPath = sProPath.Substring(0, sProPath.LastIndexOf("bin")); string sConfigFullPath = sProPath + "\\Config.xml"; //System.Windows.Forms.MessageBox.Show(sConfigFullPath); string sMachine = XmlManage.ReadXmlByNodesName(sConfigFullPath, "SystemConfig", "OracleDBConfig", "ServerName"); string sInstance = XmlManage.ReadXmlByNodesName(sConfigFullPath, "SystemConfig", "OracleDBConfig", "Instance"); string sDatabase = XmlManage.ReadXmlByNodesName(sConfigFullPath, "SystemConfig", "OracleDBConfig", "DatabaseName"); string sUserName = XmlManage.ReadXmlByNodesName(sConfigFullPath, "SystemConfig", "OracleDBConfig", "UserName"); string sPassword = XmlManage.ReadXmlByNodesName(sConfigFullPath, "SystemConfig", "OracleDBConfig", "Password"); //string sConn = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.9.200.252)(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = orcl))) ;User Id=crop;Password=crop"; string sConn = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =" + sMachine + ")(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = " + sInstance + "))) ;User Id=" + sUserName + ";Password="******""; System.Windows.Forms.MessageBox.Show(sConn); ConnectionString = sConn; }