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

📄 frmmbsjy.cs

📁 可将ACCESS数据库导入到Oracle数据库
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace DataC
{
	/// <summary>
	/// Summary description for frmMBSJY.
	/// </summary>
	public class frmMBSJY : System.Windows.Forms.Form
	{
		public 
			string strConn=null;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox tbFWQM;
		private System.Windows.Forms.TextBox tbDBN;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.ComboBox cbType;
		private System.Windows.Forms.TextBox tbPW;
		private System.Windows.Forms.TextBox tbUN;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button btOK;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmMBSJY()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.btOK = new System.Windows.Forms.Button();
			this.label2 = new System.Windows.Forms.Label();
			this.tbFWQM = new System.Windows.Forms.TextBox();
			this.tbDBN = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.cbType = new System.Windows.Forms.ComboBox();
			this.tbPW = new System.Windows.Forms.TextBox();
			this.tbUN = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.btOK);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.tbFWQM);
			this.groupBox1.Controls.Add(this.tbDBN);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.cbType);
			this.groupBox1.Controls.Add(this.tbPW);
			this.groupBox1.Controls.Add(this.tbUN);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Location = new System.Drawing.Point(2, -4);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(214, 203);
			this.groupBox1.TabIndex = 24;
			this.groupBox1.TabStop = false;
			// 
			// btOK
			// 
			this.btOK.Location = new System.Drawing.Point(120, 173);
			this.btOK.Name = "btOK";
			this.btOK.TabIndex = 34;
			this.btOK.Text = "确定";
			this.btOK.Click += new System.EventHandler(this.btOK_Click);
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(16, 56);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(54, 17);
			this.label2.TabIndex = 33;
			this.label2.Text = "服务器名";
			// 
			// tbFWQM
			// 
			this.tbFWQM.Location = new System.Drawing.Point(88, 48);
			this.tbFWQM.Name = "tbFWQM";
			this.tbFWQM.TabIndex = 1;
			this.tbFWQM.Text = "";
			// 
			// tbDBN
			// 
			this.tbDBN.Location = new System.Drawing.Point(88, 80);
			this.tbDBN.Name = "tbDBN";
			this.tbDBN.TabIndex = 2;
			this.tbDBN.Text = "";
			// 
			// label5
			// 
			this.label5.AutoSize = true;
			this.label5.Location = new System.Drawing.Point(16, 85);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(54, 17);
			this.label5.TabIndex = 30;
			this.label5.Text = "数据库名";
			// 
			// cbType
			// 
			this.cbType.Items.AddRange(new object[] {
														"SQLserver数据库",
														"Oracle数据库"});
			this.cbType.Location = new System.Drawing.Point(88, 16);
			this.cbType.Name = "cbType";
			this.cbType.Size = new System.Drawing.Size(121, 20);
			this.cbType.TabIndex = 0;
			this.cbType.Text = "SQLserver数据库";
			this.cbType.SelectedIndexChanged += new System.EventHandler(this.cbType_SelectedIndexChanged);
			// 
			// tbPW
			// 
			this.tbPW.Location = new System.Drawing.Point(88, 144);
			this.tbPW.Name = "tbPW";
			this.tbPW.PasswordChar = '#';
			this.tbPW.TabIndex = 4;
			this.tbPW.Text = "";
			// 
			// tbUN
			// 
			this.tbUN.Location = new System.Drawing.Point(88, 112);
			this.tbUN.Name = "tbUN";
			this.tbUN.TabIndex = 3;
			this.tbUN.Text = "";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(16, 152);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(29, 17);
			this.label4.TabIndex = 26;
			this.label4.Text = "密码";
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(16, 112);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(42, 17);
			this.label3.TabIndex = 25;
			this.label3.Text = "用户名";
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(8, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(66, 17);
			this.label1.TabIndex = 24;
			this.label1.Text = "数据库类型";
			// 
			// frmMBSJY
			// 
			this.AcceptButton = this.btOK;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(218, 200);
			this.ControlBox = false;
			this.Controls.Add(this.groupBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Name = "frmMBSJY";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "配置目标数据源";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void btOK_Click(object sender, System.EventArgs e)
		{
			if(tbDBN.Text=="")
			{
				MessageBox.Show("Error ****数据库名不能为空!****");
				return;
			}
			if(cbType.Text=="SQLserver数据库")
			{
				strConn="Provider=SQLOLEDB;Data Source="+tbFWQM.Text+";Integrated Security=SSPI;User ID="+tbUN.Text+";PWD="+tbPW.Text+";Initial Catalog="+tbDBN.Text;
			}
			else if(cbType.Text=="Oracle数据库")
			{
				strConn="Provider=OraOLEDB.Oracle.1;User ID="+tbUN.Text+";Data Source="+tbDBN.Text+";Persist Security Info=True;Password="+tbPW.Text;
			}

			this.Close();
		}

		private void cbType_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if(cbType.Text=="SQLserver数据库")
			{
				tbFWQM.Enabled=true;
			}
			else if(cbType.Text=="Oracle数据库")
			{
				tbFWQM.Enabled=false;
			}
		}



	}
}

⌨️ 快捷键说明

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