예제 #1
0
        private void frmConnectionString_Load(object sender, EventArgs e)
        {
            if (CsTools.LoadCs("VisaXEntities").DataSource == "(LocalDB)\\MSSQLLocalDB")
            {
                cmbConnectionType.SelectedIndex = 0;
            }
            else
            {
                cmbConnectionType.SelectedIndex = 1;
            }

            txtConnectionString.Text = CsTools.LoadCsWithMetadata("VisaXEntities");
        }
예제 #2
0
        private void cmbConnectionType_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbDataSource.Enabled = cmbConnectionType.SelectedIndex == 0 ? false : true;

            if (cmbConnectionType.SelectedIndex == 0)
            {
                txtConnectionString.Text = CsTools.LoadCsWithMetadata("VisaXEntitiesLocal");
            }
            if (cmbConnectionType.SelectedIndex == 1)
            {
                txtConnectionString.Text = CsTools.LoadCsWithMetadata("VisaXEntitiesSQL");
            }
        }
예제 #3
0
        private void btnSet_Click(object sender, EventArgs e)
        {
            Exception ex;

            if (checkState(out ex) == ConnectionState.Open)
            {
                CsTools.SaveCs("VisaXEntities", txtConnectionString.Text);
                MessageBox.Show("اتصال به پایگاه داده تنظیم شد.", " اتصال به پایگاه داده...", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                Application.Restart();
            }
            else
            {
                MessageBox.Show("اتصال به پایگاه داده معتبر نیست.\n" + ex.Message);
            }
        }
예제 #4
0
 private void cmbDataSource_TextChanged(object sender, EventArgs e)
 {
     txtConnectionString.Text = CsTools.ChangeCsWithMetadata(txtConnectionString.Text, cmbDataSource.Text).ConnectionString;
 }