Example #1
0
        private void BtnLogin_Click(object sender, System.EventArgs e)
        {
            FrmMain Main =new FrmMain();
            System.Data.OleDb.OleDbConnection Ole=new System.Data.OleDb.OleDbConnection();
            UserName=TxtUserName.Text;
            Password=TxtPassword.Text;
            Database=TxtDatabase.Text;
            ConnectStr="Provider=OraOLEDB.Oracle.1;User ID="+UserName+";Password="******";Data Source="+Database+";Extended Properties=;Persist Security Info=True";
            //	ConnectStr="Provider=OraOLEDB.Oracle;User ID="+UserName+";Password="******";Data Source="+Database+"PLSQLRset=1";

            if (!System.IO.File.Exists("ConnectStrTCBS.txt"))
                  System.IO.File.Create("ConnectStrTCBS.txt",100);

            try
            {
                System.IO.StreamWriter str=new System.IO.StreamWriter("ConnectStrTCBS.txt");
                str.WriteLine(ConnectStr);
                str.WriteLine(UserName+"@"+Database);
                str.WriteLine("Yes");
                str.Close();

                Ole.ConnectionString=ConnectStr;
                Ole.Open();
                MessageBox.Show("Database is connected!");
                this.Close();
                Ole.Close();

                FrmCompareTCBS_Switch frm =new FrmCompareTCBS_Switch();
                frm.MdiParent=FrmMain.ActiveForm.ActiveMdiChild;
                frm.Show();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void MAppCompareTran_Click(object sender, System.EventArgs e)
        {
            string tem;
            //	FrmLoginTCBS frm =new FrmLoginTCBS();
            //	frm.ShowDialog();

            System.IO.StreamReader str=new System.IO.StreamReader("ConnectStr.txt");
            tem=str.ReadLine();
            tem=str.ReadLine();
            str.Close();

                FrmCompareTCBS_Switch frm1 = new FrmCompareTCBS_Switch();
                frm1.MdiParent=this;
                frm1.Show();
                frm1.Text=tem;
        }