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

📄 form1.cs

📁 查看Sqlserver的版本信息
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using MYSQLDB;
using System.Data.SqlClient;
using System.Threading;

namespace SQL_CMD
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPgLogin;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ComboBox cmbServer;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox txtUser;
		private System.Windows.Forms.TextBox txtPassword;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.TabPage tabPgSelect;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox txtCondition;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Button btnQuery;
		private System.Windows.Forms.DataGrid dataGrid1;
		private SqlDataAdapter da;
		private DataSet ds=new DataSet();
		private SqlConnection sqlconn;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.ComboBox cmbDatabase;
		private bool m_isconnected = false;
		string connstr;
		string connstrdef = "Data Source=datasourcename;Initial Catalog=databasename;User Id=username;Password=userpassword;Connection Timeout=15;Connection Lifetime=60";
		private System.Windows.Forms.ComboBox cmbTableName;
		private System.Windows.Forms.Button btnStructure;
	
		public delegate void  mydelegate();
		private MySqlCMD mycmd= new MySqlCMD();

		public Form1()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPgLogin = new System.Windows.Forms.TabPage();
			this.label4 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.txtPassword = new System.Windows.Forms.TextBox();
			this.txtUser = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.cmbServer = new System.Windows.Forms.ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.tabPgSelect = new System.Windows.Forms.TabPage();
			this.cmbTableName = new System.Windows.Forms.ComboBox();
			this.cmbDatabase = new System.Windows.Forms.ComboBox();
			this.label7 = new System.Windows.Forms.Label();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.btnQuery = new System.Windows.Forms.Button();
			this.txtCondition = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.btnStructure = new System.Windows.Forms.Button();
			this.tabControl1.SuspendLayout();
			this.tabPgLogin.SuspendLayout();
			this.tabPgSelect.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			this.SuspendLayout();
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPgLogin);
			this.tabControl1.Controls.Add(this.tabPgSelect);
			this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.tabControl1.ImeMode = System.Windows.Forms.ImeMode.Disable;
			this.tabControl1.Location = new System.Drawing.Point(0, 0);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(472, 342);
			this.tabControl1.TabIndex = 0;
			// 
			// tabPgLogin
			// 
			this.tabPgLogin.Controls.Add(this.label4);
			this.tabPgLogin.Controls.Add(this.button1);
			this.tabPgLogin.Controls.Add(this.txtPassword);
			this.tabPgLogin.Controls.Add(this.txtUser);
			this.tabPgLogin.Controls.Add(this.label3);
			this.tabPgLogin.Controls.Add(this.label2);
			this.tabPgLogin.Controls.Add(this.cmbServer);
			this.tabPgLogin.Controls.Add(this.label1);
			this.tabPgLogin.Location = new System.Drawing.Point(4, 21);
			this.tabPgLogin.Name = "tabPgLogin";
			this.tabPgLogin.Size = new System.Drawing.Size(464, 317);
			this.tabPgLogin.TabIndex = 0;
			this.tabPgLogin.Text = "Connect";
			this.tabPgLogin.Click += new System.EventHandler(this.tabPgLogin_Click);
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(56, 176);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(336, 120);
			this.label4.TabIndex = 7;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(296, 136);
			this.button1.Name = "button1";
			this.button1.TabIndex = 6;
			this.button1.Text = "Connect";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// txtPassword
			// 
			this.txtPassword.Location = new System.Drawing.Point(136, 136);
			this.txtPassword.Name = "txtPassword";
			this.txtPassword.PasswordChar = '*';
			this.txtPassword.Size = new System.Drawing.Size(152, 21);
			this.txtPassword.TabIndex = 5;
			this.txtPassword.Text = "usermba";
			// 
			// txtUser
			// 
			this.txtUser.Location = new System.Drawing.Point(136, 96);
			this.txtUser.Name = "txtUser";
			this.txtUser.Size = new System.Drawing.Size(152, 21);
			this.txtUser.TabIndex = 4;
			this.txtUser.Text = "usermba";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(56, 136);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(72, 23);
			this.label3.TabIndex = 3;
			this.label3.Text = "Password";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(56, 96);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 23);
			this.label2.TabIndex = 2;
			this.label2.Text = "UserName";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// cmbServer
			// 
			this.cmbServer.Location = new System.Drawing.Point(136, 56);
			this.cmbServer.Name = "cmbServer";
			this.cmbServer.Size = new System.Drawing.Size(152, 20);
			this.cmbServer.TabIndex = 1;
			this.cmbServer.TextChanged += new System.EventHandler(this.cmbServer_TextChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(56, 56);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 23);
			this.label1.TabIndex = 0;
			this.label1.Text = "Servers";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// tabPgSelect
			// 
			this.tabPgSelect.Controls.Add(this.btnStructure);
			this.tabPgSelect.Controls.Add(this.cmbTableName);
			this.tabPgSelect.Controls.Add(this.cmbDatabase);
			this.tabPgSelect.Controls.Add(this.label7);
			this.tabPgSelect.Controls.Add(this.dataGrid1);
			this.tabPgSelect.Controls.Add(this.btnQuery);
			this.tabPgSelect.Controls.Add(this.txtCondition);
			this.tabPgSelect.Controls.Add(this.label6);
			this.tabPgSelect.Controls.Add(this.label5);
			this.tabPgSelect.Location = new System.Drawing.Point(4, 21);
			this.tabPgSelect.Name = "tabPgSelect";
			this.tabPgSelect.Size = new System.Drawing.Size(464, 317);
			this.tabPgSelect.TabIndex = 1;
			this.tabPgSelect.Text = "Select";
			// 
			// cmbTableName
			// 
			this.cmbTableName.Location = new System.Drawing.Point(88, 32);
			this.cmbTableName.Name = "cmbTableName";
			this.cmbTableName.Size = new System.Drawing.Size(176, 20);
			this.cmbTableName.TabIndex = 9;
			// 
			// cmbDatabase
			// 
			this.cmbDatabase.Location = new System.Drawing.Point(88, 8);
			this.cmbDatabase.Name = "cmbDatabase";
			this.cmbDatabase.Size = new System.Drawing.Size(176, 20);
			this.cmbDatabase.TabIndex = 8;
			this.cmbDatabase.SelectedIndexChanged += new System.EventHandler(this.cmbDatabase_SelectedIndexChanged);
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(8, 8);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(72, 23);
			this.label7.TabIndex = 7;
			this.label7.Text = "DataBase";

⌨️ 快捷键说明

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