Exemplo n.º 1
0
        private void SetInfo()
        {
            if (lupAccount.EditValue == DBNull.Value)
            {
                return;
            }
            DataRow dr = ((DataRowView)lupAccount.Properties.GetDataSourceRowByDisplayValue(lupAccount.Text)).Row;
            //DataLib.SysVar.strSysCon = "Data Source=.;Initial Catalog=" + dr["FDBName"].ToString() + ";Persist Security Info=True;User ID=" + DataLib.SysVar.strLogID + ";Password="******".";

            if (DataLib.SysVar.strServer == "localhost")
            {
                DataLib.sysClass myClass = new DataLib.sysClass();
                string[]         strIP   = myClass.GetIP();
                strHost = strIP[0];
            }
            else
            {
                strHost = DataLib.SysVar.strServer;
            }

            DataLib.DataHelper myHelper = new DataLib.DataHelper();
            myHelper.SetPrintInfo();

            DataLib.SysVar.strDB  = dr["FDBName"].ToString();
            DataLib.SysVar.strCon = "Provider=SQLOLEDB.1;Password="******";Persist Security Info=False;User ID=" + DataLib.SysVar.strLogID + ";Initial Catalog=" + dr["FDBName"].ToString() + ";Data Source=" + strHost;
            // MessageBox.Show(DataLib.SysVar.strCon);
        }
Exemplo n.º 2
0
        private void sbOK_Click(object sender, EventArgs e)
        {
            if (gvAccount.FocusedRowHandle < 0)
            {
                return;
            }
            DataRow dr = gvAccount.GetDataRow(gvAccount.FocusedRowHandle);
            //DataLib.SysVar.strSysCon = "Data Source=.;Initial Catalog=" + dr["FDBName"].ToString() + ";Persist Security Info=True;User ID=" + DataLib.SysVar.strLogID + ";Password="******".";

            if (DataLib.SysVar.strServer == "localhost")
            {
                DataLib.sysClass myClass = new DataLib.sysClass();
                string[]         strIP   = myClass.GetIP();
                strHost = strIP[0];
            }
            else
            {
                strHost = DataLib.SysVar.strServer;
            }

            DataLib.DataHelper myHelper = new DataLib.DataHelper();
            myHelper.SetPrintInfo();

            DataLib.SysVar.strDB  = dr["FDBName"].ToString();
            DataLib.SysVar.strCon = "Provider=SQLOLEDB.1;Password="******";Persist Security Info=False;User ID=" + DataLib.SysVar.strLogID + ";Initial Catalog=" + dr["FDBName"].ToString() + ";Data Source=" + strHost;
            this.DialogResult     = DialogResult.OK;
        }