⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loginform.cs

📁 通过数据库结构自动 生成三层结构代码,相当不错的一款软件
💻 CS
📖 第 1 页 / 共 2 页
字号:
            }
            return "SQL";
        }

        private string GetSQLVer(string connectionString)
        {
            string str3;
            string cmdText = "select serverproperty('productversion')";
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                using (SqlCommand command = new SqlCommand(cmdText, connection))
                {
                    try
                    {
                        connection.Open();
                        object objA = command.ExecuteScalar();
                        if (object.Equals(objA, null) || object.Equals(objA, DBNull.Value))
                        {
                            return "";
                        }
                        string str2 = objA.ToString().Trim();
                        if (str2.Length > 1)
                        {
                            return str2.Substring(0, 1);
                        }
                        str3 = "";
                    }
                    catch (SqlException exception)
                    {
                        connection.Close();
                        LogInfo.WriteLog(exception);
                        throw exception;
                    }
                    finally
                    {
                        command.Dispose();
                        connection.Close();
                    }
                }
            }
            return str3;
        }

        public void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(LoginForm));
            this.label1 = new Label();
            this.groupBox1 = new GroupBox();
            this.cmbDBlist = new ComboBox();
            this.label4 = new Label();
            this.txtUser = new TextBox();
            this.label2 = new Label();
            this.txtPass = new TextBox();
            this.label3 = new Label();
            this.toolTip1 = new ToolTip(this.components);
            this.chk_Simple = new CheckBox();
            this.btn_Ok = new ButtonXP();
            this.btn_Cancel = new ButtonXP();
            this.btn_ConTest = new ButtonXP();
            this.comboBoxServer = new ComboBox();
            this.label5 = new Label();
            this.comboBoxServerVer = new ComboBox();
            this.label6 = new Label();
            this.comboBox_Verified = new ComboBox();
            this.pictureBox1 = new PictureBox();
            ((ISupportInitialize) this.pictureBox1).BeginInit();
            base.SuspendLayout();
            this.label1.AutoSize = true;
            this.label1.Location = new Point(0x18, 0x65);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x5f, 12);
            this.label1.TabIndex = 0;
            this.label1.Text = "服务器名称(&S):";
            this.label1.TextAlign = ContentAlignment.MiddleCenter;
            this.groupBox1.Location = new Point(0x20, 0x10b);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(380, 5);
            this.groupBox1.TabIndex = 2;
            this.groupBox1.TabStop = false;
            this.cmbDBlist.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cmbDBlist.Enabled = false;
            this.cmbDBlist.Location = new Point(0x90, 0xdb);
            this.cmbDBlist.Name = "cmbDBlist";
            this.cmbDBlist.Size = new Size(0xe8, 20);
            this.cmbDBlist.TabIndex = 6;
            this.label4.AutoSize = true;
            this.label4.Location = new Point(0x30, 0xdf);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x47, 12);
            this.label4.TabIndex = 5;
            this.label4.Text = "数据库(&D):";
            this.txtUser.Location = new Point(0x90, 0xa9);
            this.txtUser.Name = "txtUser";
            this.txtUser.Size = new Size(0xe8, 0x15);
            this.txtUser.TabIndex = 3;
            this.txtUser.Text = "sa";
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0x30, 0xad);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x47, 12);
            this.label2.TabIndex = 2;
            this.label2.Text = "登录名(&L):";
            this.txtPass.Location = new Point(0x90, 0xc2);
            this.txtPass.Name = "txtPass";
            this.txtPass.PasswordChar = '*';
            this.txtPass.Size = new Size(0xe8, 0x15);
            this.txtPass.TabIndex = 3;
            this.label3.AutoSize = true;
            this.label3.Location = new Point(60, 0xc6);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x3b, 12);
            this.label3.TabIndex = 2;
            this.label3.Text = "密码(&P):";
            this.chk_Simple.AutoSize = true;
            this.chk_Simple.Checked = true;
            this.chk_Simple.CheckState = CheckState.Checked;
            this.chk_Simple.Location = new Point(0x90, 0xf4);
            this.chk_Simple.Name = "chk_Simple";
            this.chk_Simple.Size = new Size(0x60, 0x10);
            this.chk_Simple.TabIndex = 0x16;
            this.chk_Simple.Text = "高效连接模式";
            this.toolTip1.SetToolTip(this.chk_Simple, "在表非常多的情况下,启用该模式提高连接速度");
            this.chk_Simple.UseVisualStyleBackColor = true;
            this.btn_Ok._Image = null;
            this.btn_Ok.BackColor = Color.FromArgb(0, 0xec, 0xe9, 0xd8);
            this.btn_Ok.DefaultScheme = false;
            this.btn_Ok.DialogResult = DialogResult.None;
            this.btn_Ok.Image = null;
            this.btn_Ok.Location = new Point(0xa3, 0x11f);
            this.btn_Ok.Name = "btn_Ok";
            this.btn_Ok.Scheme = ButtonXP.Schemes.Blue;
            this.btn_Ok.Size = new Size(80, 0x1c);
            this.btn_Ok.TabIndex = 0x13;
            this.btn_Ok.Text = "确定(&O):";
            this.btn_Ok.Click += new EventHandler(this.btn_Ok_Click);
            this.btn_Cancel._Image = null;
            this.btn_Cancel.BackColor = Color.FromArgb(0, 0xec, 0xe9, 0xd8);
            this.btn_Cancel.DefaultScheme = false;
            this.btn_Cancel.DialogResult = DialogResult.Cancel;
            this.btn_Cancel.Image = null;
            this.btn_Cancel.Location = new Point(270, 0x11f);
            this.btn_Cancel.Name = "btn_Cancel";
            this.btn_Cancel.Scheme = ButtonXP.Schemes.Blue;
            this.btn_Cancel.Size = new Size(80, 0x1c);
            this.btn_Cancel.TabIndex = 20;
            this.btn_Cancel.Text = "取消(&C):";
            this.btn_Cancel.Click += new EventHandler(this.btn_Cancel_Click);
            this.btn_ConTest._Image = null;
            this.btn_ConTest.BackColor = Color.FromArgb(0, 0xec, 0xe9, 0xd8);
            this.btn_ConTest.DefaultScheme = false;
            this.btn_ConTest.DialogResult = DialogResult.None;
            this.btn_ConTest.Image = null;
            this.btn_ConTest.Location = new Point(0x38, 0x11f);
            this.btn_ConTest.Name = "btn_ConTest";
            this.btn_ConTest.Scheme = ButtonXP.Schemes.Blue;
            this.btn_ConTest.Size = new Size(80, 0x1c);
            this.btn_ConTest.TabIndex = 0x13;
            this.btn_ConTest.Text = "连接/测试";
            this.btn_ConTest.Click += new EventHandler(this.btn_ConTest_Click);
            this.comboBoxServer.FormattingEnabled = true;
            this.comboBoxServer.Location = new Point(0x90, 0x61);
            this.comboBoxServer.Name = "comboBoxServer";
            this.comboBoxServer.Size = new Size(0xe8, 20);
            this.comboBoxServer.TabIndex = 0x15;
            this.comboBoxServer.Text = "127.0.0.1";
            this.label5.AutoSize = true;
            this.label5.Location = new Point(0x18, 0x7d);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x5f, 12);
            this.label5.TabIndex = 0;
            this.label5.Text = "服务器类型(&T):";
            this.label5.TextAlign = ContentAlignment.MiddleCenter;
            this.comboBoxServerVer.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBoxServerVer.FormattingEnabled = true;
            this.comboBoxServerVer.Items.AddRange(new object[] { "SQL Server2005", "SQL Server2000" });
            this.comboBoxServerVer.Location = new Point(0x90, 0x79);
            this.comboBoxServerVer.Name = "comboBoxServerVer";
            this.comboBoxServerVer.Size = new Size(0xe8, 20);
            this.comboBoxServerVer.TabIndex = 0x15;
            this.label6.AutoSize = true;
            this.label6.Location = new Point(0x24, 0x95);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x53, 12);
            this.label6.TabIndex = 0;
            this.label6.Text = "身份验证(&A):";
            this.label6.TextAlign = ContentAlignment.MiddleCenter;
            this.comboBox_Verified.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox_Verified.FormattingEnabled = true;
            this.comboBox_Verified.Items.AddRange(new object[] { "SQL Server 身份认证", "Windows 身份认证" });
            this.comboBox_Verified.Location = new Point(0x90, 0x91);
            this.comboBox_Verified.Name = "comboBox_Verified";
            this.comboBox_Verified.Size = new Size(0xe8, 20);
            this.comboBox_Verified.TabIndex = 0x15;
            this.comboBox_Verified.SelectedIndexChanged += new EventHandler(this.comboBox_Verified_SelectedIndexChanged);
            this.pictureBox1.Image = Resources.loginsql;
            this.pictureBox1.Location = new Point(0, 0);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new Size(0x1c3, 0x51);
            this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
            this.pictureBox1.TabIndex = 0x17;
            this.pictureBox1.TabStop = false;
            base.AcceptButton = this.btn_Ok;
            this.AutoScaleBaseSize = new Size(6, 14);
            base.CancelButton = this.btn_Cancel;
            base.ClientSize = new Size(0x1c1, 0x153);
            base.Controls.Add(this.pictureBox1);
            base.Controls.Add(this.chk_Simple);
            base.Controls.Add(this.comboBox_Verified);
            base.Controls.Add(this.comboBoxServerVer);
            base.Controls.Add(this.comboBoxServer);
            base.Controls.Add(this.cmbDBlist);
            base.Controls.Add(this.btn_Cancel);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.btn_Ok);
            base.Controls.Add(this.txtUser);
            base.Controls.Add(this.groupBox1);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.label6);
            base.Controls.Add(this.label5);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.txtPass);
            base.Controls.Add(this.btn_ConTest);
            base.Controls.Add(this.label3);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "LoginForm";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "连接到服务器";
            base.Load += new EventHandler(this.LoginForm_Load);
            ((ISupportInitialize) this.pictureBox1).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void LoginForm_Load(object sender, EventArgs e)
        {
            this.toolTip1.SetToolTip(this.txtUser, "请保证该用户具有每个数据库的访问权!");
            this.comboBoxServerVer.SelectedIndex = 0;
            this.comboBox_Verified.SelectedIndex = 0;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -