?? form1.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Data.OracleClient;
using System.Text;
using System.IO;
namespace excelToOracle
{
/// <summary>
/// Form1 的摘要說明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button openExcel;
private System.Windows.Forms.CheckedListBox checkedListBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Data.DataSet myDataSet;
private System.Data.DataSet myDataSet1;
private System.Data.DataSet myDataSet2;
private System.Data.DataSet myDataSet4;
public static string severName;
public static string datasource;
public static string uidName;
public static string uidPwd;
string fName="";
string strPath="";
string tableName="";
string timeStart="";
string timeEnd="";
string timeSum="";
int columnNum;
int rowsNum;
int excepNum;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.CheckedListBox checkedListBox2;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.MenuItem menuItem8;
private System.Windows.Forms.MenuItem menuItem9;
private System.Windows.Forms.GroupBox groupbox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.CheckBox checkBox1;
/// <summary>
/// 必需的設(shè)計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗體設(shè)計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計器生成的代碼
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.openExcel = new System.Windows.Forms.Button();
this.checkedListBox1 = new System.Windows.Forms.CheckedListBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.checkedListBox2 = new System.Windows.Forms.CheckedListBox();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem8 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.groupbox1 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.button7 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.groupbox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(24, 32);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(96, 21);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// openExcel
//
this.openExcel.Location = new System.Drawing.Point(128, 32);
this.openExcel.Name = "openExcel";
this.openExcel.Size = new System.Drawing.Size(64, 23);
this.openExcel.TabIndex = 1;
this.openExcel.Text = "瀏覽";
this.openExcel.Click += new System.EventHandler(this.openExcel_Click);
//
// checkedListBox1
//
this.checkedListBox1.Location = new System.Drawing.Point(24, 72);
this.checkedListBox1.Name = "checkedListBox1";
this.checkedListBox1.Size = new System.Drawing.Size(136, 132);
this.checkedListBox1.TabIndex = 2;
//
// button2
//
this.button2.Location = new System.Drawing.Point(168, 104);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(24, 23);
this.button2.TabIndex = 3;
this.button2.Text = "︽";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(168, 152);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(24, 23);
this.button3.TabIndex = 4;
this.button3.Text = "︾";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(144, 32);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 24);
this.button1.TabIndex = 6;
this.button1.Text = "數(shù)據(jù)庫鏈接";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(24, 32);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(112, 20);
this.comboBox1.TabIndex = 7;
this.comboBox1.SelectedValueChanged += new System.EventHandler(this.comboBox1_SelectedValueChanged);
//
// checkedListBox2
//
this.checkedListBox2.Location = new System.Drawing.Point(24, 72);
this.checkedListBox2.Name = "checkedListBox2";
this.checkedListBox2.Size = new System.Drawing.Size(136, 132);
this.checkedListBox2.TabIndex = 8;
//
// button4
//
this.button4.Location = new System.Drawing.Point(168, 104);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(24, 23);
this.button4.TabIndex = 9;
this.button4.Text = "︽";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(168, 152);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(24, 23);
this.button5.TabIndex = 10;
this.button5.Text = "︾";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(312, 464);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(64, 23);
this.button6.TabIndex = 11;
this.button6.Text = "開始導(dǎo)入";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2,
this.menuItem3});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem4,
this.menuItem5,
this.menuItem6});
this.menuItem1.Text = "文件";
//
// menuItem4
//
this.menuItem4.Index = 0;
this.menuItem4.Text = "數(shù)據(jù)庫鏈接";
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.Text = "打開Excel文件";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// menuItem6
//
this.menuItem6.Index = 2;
this.menuItem6.Text = "退出";
this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem7});
this.menuItem2.Text = "數(shù)據(jù)處理";
//
// menuItem7
//
this.menuItem7.Index = 0;
this.menuItem7.Text = "導(dǎo)入";
this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem8,
this.menuItem9});
this.menuItem3.Text = "幫助";
//
// menuItem8
//
this.menuItem8.Index = 0;
this.menuItem8.Text = "操作幫助";
this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
//
// menuItem9
//
this.menuItem9.Index = 1;
this.menuItem9.Text = "關(guān)于..";
this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
//
// groupbox1
//
this.groupbox1.Controls.Add(this.checkedListBox1);
this.groupbox1.Controls.Add(this.button3);
this.groupbox1.Controls.Add(this.button2);
this.groupbox1.Controls.Add(this.textBox1);
this.groupbox1.Controls.Add(this.openExcel);
this.groupbox1.Controls.Add(this.label1);
this.groupbox1.Controls.Add(this.label2);
this.groupbox1.Location = new System.Drawing.Point(16, 8);
this.groupbox1.Name = "groupbox1";
this.groupbox1.Size = new System.Drawing.Size(224, 248);
this.groupbox1.TabIndex = 15;
this.groupbox1.TabStop = false;
this.groupbox1.Text = "Excel表";
this.groupbox1.Enter += new System.EventHandler(this.groupbox1_Enter);
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 56);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 16);
this.label1.TabIndex = 11;
this.label1.Text = "選擇Excel表列:";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(100, 16);
this.label2.TabIndex = 21;
this.label2.Text = "選擇Excel文件:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.checkBox1);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.comboBox1);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.checkedListBox2);
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.button5);
this.groupBox2.Location = new System.Drawing.Point(280, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(232, 248);
this.groupBox2.TabIndex = 16;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Oracle表";
//
// label4
//
this.label4.Location = new System.Drawing.Point(24, 56);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(112, 16);
this.label4.TabIndex = 12;
this.label4.Text = "選擇Oracle表列:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(24, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 16);
this.label3.TabIndex = 11;
this.label3.Text = "選擇Oracle表:";
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(8, 16);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(472, 136);
this.richTextBox1.TabIndex = 17;
this.richTextBox1.Text = "";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.richTextBox1);
this.groupBox3.Location = new System.Drawing.Point(24, 296);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(488, 160);
this.groupBox3.TabIndex = 18;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "數(shù)據(jù)導(dǎo)入日志";
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 489);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(520, 16);
this.statusBar1.TabIndex = 20;
this.statusBar1.Text = " ";
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(112, 264);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(400, 23);
this.progressBar1.TabIndex = 21;
//
// label5
//
this.label5.Location = new System.Drawing.Point(32, 264);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 24);
this.label5.TabIndex = 22;
this.label5.Text = "正在導(dǎo)入...";
this.label5.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
//
// label6
//
this.label6.Font = new System.Drawing.Font("宋體", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label6.Location = new System.Drawing.Point(248, 128);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(32, 23);
this.label6.TabIndex = 23;
this.label6.Text = "=>";
//
// button7
//
this.button7.Location = new System.Drawing.Point(408, 464);
this.button7.Name = "button7";
this.button7.TabIndex = 24;
this.button7.Text = "退出";
this.button7.Click += new System.EventHandler(this.button7_Click_1);
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(24, 216);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(120, 24);
this.checkBox1.TabIndex = 13;
this.checkBox1.Text = "先刪除,再導(dǎo)入";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(520, 505);
this.Controls.Add(this.button7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupbox1);
this.Controls.Add(this.button6);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Excel表數(shù)據(jù)導(dǎo)入Oracle數(shù)據(jù)庫表程序";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupbox1.ResumeLayout(false);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -