Commit b9c32a0b authored by tr's avatar tr

1、导出检查时,增加数据库链接判断,防止报错

parent 26f8a48f
...@@ -30,10 +30,21 @@ ...@@ -30,10 +30,21 @@
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
this.tsmiExportModel = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiExportSql = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiExportExcel = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiExportWord = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.tsbLoadTable = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.tsbTempSave = new System.Windows.Forms.ToolStripButton();
this.tsbResume = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.tsbDbLink = new System.Windows.Forms.ToolStripButton();
this.tstbDbLink = new System.Windows.Forms.ToolStripTextBox(); this.tstbDbLink = new System.Windows.Forms.ToolStripTextBox();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.tsbHelp = new System.Windows.Forms.ToolStripButton();
this.dgvData = new System.Windows.Forms.DataGridView(); this.dgvData = new System.Windows.Forms.DataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
...@@ -50,17 +61,6 @@ ...@@ -50,17 +61,6 @@
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.tbTableName = new System.Windows.Forms.TextBox(); this.tbTableName = new System.Windows.Forms.TextBox();
this.tbTableDescription = new System.Windows.Forms.TextBox(); this.tbTableDescription = new System.Windows.Forms.TextBox();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
this.tsmiExportModel = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiExportSql = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiExportExcel = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiExportWord = new System.Windows.Forms.ToolStripMenuItem();
this.tsbLoadTable = new System.Windows.Forms.ToolStripButton();
this.tsbTempSave = new System.Windows.Forms.ToolStripButton();
this.tsbResume = new System.Windows.Forms.ToolStripButton();
this.tsbDbLink = new System.Windows.Forms.ToolStripButton();
this.tsbHelp = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvData)).BeginInit();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
...@@ -88,16 +88,94 @@ ...@@ -88,16 +88,94 @@
this.toolStrip1.TabIndex = 0; this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1"; this.toolStrip1.Text = "toolStrip1";
// //
// toolStripDropDownButton1
//
this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiExportModel,
this.tsmiExportSql,
this.tsmiExportExcel,
this.tsmiExportWord});
this.toolStripDropDownButton1.Image = global::Tools.Properties.Resources.导出;
this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
this.toolStripDropDownButton1.Size = new System.Drawing.Size(85, 21);
this.toolStripDropDownButton1.Text = "导出文件";
//
// tsmiExportModel
//
this.tsmiExportModel.Image = global::Tools.Properties.Resources.类;
this.tsmiExportModel.Name = "tsmiExportModel";
this.tsmiExportModel.Size = new System.Drawing.Size(123, 22);
this.tsmiExportModel.Text = "实体类";
//
// tsmiExportSql
//
this.tsmiExportSql.Image = global::Tools.Properties.Resources.sql;
this.tsmiExportSql.Name = "tsmiExportSql";
this.tsmiExportSql.Size = new System.Drawing.Size(123, 22);
this.tsmiExportSql.Text = "SQL文件";
//
// tsmiExportExcel
//
this.tsmiExportExcel.Image = global::Tools.Properties.Resources.excel;
this.tsmiExportExcel.Name = "tsmiExportExcel";
this.tsmiExportExcel.Size = new System.Drawing.Size(123, 22);
this.tsmiExportExcel.Text = "Excel";
//
// tsmiExportWord
//
this.tsmiExportWord.Image = global::Tools.Properties.Resources.word;
this.tsmiExportWord.Name = "tsmiExportWord";
this.tsmiExportWord.Size = new System.Drawing.Size(123, 22);
this.tsmiExportWord.Text = "Word";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 23);
//
// tsbLoadTable
//
this.tsbLoadTable.Image = global::Tools.Properties.Resources.加载;
this.tsbLoadTable.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbLoadTable.Name = "tsbLoadTable";
this.tsbLoadTable.Size = new System.Drawing.Size(88, 21);
this.tsbLoadTable.Text = "加载表信息";
//
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 23); this.toolStripSeparator2.Size = new System.Drawing.Size(6, 23);
// //
// tsbTempSave
//
this.tsbTempSave.Image = global::Tools.Properties.Resources.暂存;
this.tsbTempSave.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbTempSave.Name = "tsbTempSave";
this.tsbTempSave.Size = new System.Drawing.Size(52, 21);
this.tsbTempSave.Text = "暂存";
//
// tsbResume
//
this.tsbResume.Image = global::Tools.Properties.Resources.恢复;
this.tsbResume.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbResume.Name = "tsbResume";
this.tsbResume.Size = new System.Drawing.Size(76, 21);
this.tsbResume.Text = "恢复暂存";
//
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 23); this.toolStripSeparator1.Size = new System.Drawing.Size(6, 23);
// //
// tsbDbLink
//
this.tsbDbLink.Image = global::Tools.Properties.Resources.数据库;
this.tsbDbLink.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbDbLink.Name = "tsbDbLink";
this.tsbDbLink.Size = new System.Drawing.Size(88, 21);
this.tsbDbLink.Text = "数据库配置";
//
// tstbDbLink // tstbDbLink
// //
this.tstbDbLink.Enabled = false; this.tstbDbLink.Enabled = false;
...@@ -110,6 +188,14 @@ ...@@ -110,6 +188,14 @@
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 23); this.toolStripSeparator3.Size = new System.Drawing.Size(6, 23);
// //
// tsbHelp
//
this.tsbHelp.Image = global::Tools.Properties.Resources.使用说明;
this.tsbHelp.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbHelp.Name = "tsbHelp";
this.tsbHelp.Size = new System.Drawing.Size(76, 21);
this.tsbHelp.Text = "使用说明";
//
// dgvData // dgvData
// //
this.dgvData.BackgroundColor = System.Drawing.SystemColors.Window; this.dgvData.BackgroundColor = System.Drawing.SystemColors.Window;
...@@ -280,92 +366,6 @@ ...@@ -280,92 +366,6 @@
this.tbTableDescription.Size = new System.Drawing.Size(152, 23); this.tbTableDescription.Size = new System.Drawing.Size(152, 23);
this.tbTableDescription.TabIndex = 5; this.tbTableDescription.TabIndex = 5;
// //
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 23);
//
// toolStripDropDownButton1
//
this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiExportModel,
this.tsmiExportSql,
this.tsmiExportExcel,
this.tsmiExportWord});
this.toolStripDropDownButton1.Image = global::Tools.Properties.Resources.导出;
this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
this.toolStripDropDownButton1.Size = new System.Drawing.Size(85, 21);
this.toolStripDropDownButton1.Text = "导出文件";
//
// tsmiExportModel
//
this.tsmiExportModel.Image = global::Tools.Properties.Resources.类;
this.tsmiExportModel.Name = "tsmiExportModel";
this.tsmiExportModel.Size = new System.Drawing.Size(180, 22);
this.tsmiExportModel.Text = "实体类";
//
// tsmiExportSql
//
this.tsmiExportSql.Image = global::Tools.Properties.Resources.sql;
this.tsmiExportSql.Name = "tsmiExportSql";
this.tsmiExportSql.Size = new System.Drawing.Size(180, 22);
this.tsmiExportSql.Text = "SQL文件";
//
// tsmiExportExcel
//
this.tsmiExportExcel.Image = global::Tools.Properties.Resources.excel;
this.tsmiExportExcel.Name = "tsmiExportExcel";
this.tsmiExportExcel.Size = new System.Drawing.Size(180, 22);
this.tsmiExportExcel.Text = "Excel";
//
// tsmiExportWord
//
this.tsmiExportWord.Image = global::Tools.Properties.Resources.word;
this.tsmiExportWord.Name = "tsmiExportWord";
this.tsmiExportWord.Size = new System.Drawing.Size(180, 22);
this.tsmiExportWord.Text = "Word";
//
// tsbLoadTable
//
this.tsbLoadTable.Image = global::Tools.Properties.Resources.加载;
this.tsbLoadTable.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbLoadTable.Name = "tsbLoadTable";
this.tsbLoadTable.Size = new System.Drawing.Size(88, 21);
this.tsbLoadTable.Text = "加载表信息";
//
// tsbTempSave
//
this.tsbTempSave.Image = global::Tools.Properties.Resources.暂存;
this.tsbTempSave.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbTempSave.Name = "tsbTempSave";
this.tsbTempSave.Size = new System.Drawing.Size(52, 21);
this.tsbTempSave.Text = "暂存";
//
// tsbResume
//
this.tsbResume.Image = global::Tools.Properties.Resources.恢复;
this.tsbResume.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbResume.Name = "tsbResume";
this.tsbResume.Size = new System.Drawing.Size(76, 21);
this.tsbResume.Text = "恢复暂存";
//
// tsbDbLink
//
this.tsbDbLink.Image = global::Tools.Properties.Resources.数据库;
this.tsbDbLink.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbDbLink.Name = "tsbDbLink";
this.tsbDbLink.Size = new System.Drawing.Size(88, 21);
this.tsbDbLink.Text = "数据库配置";
//
// tsbHelp
//
this.tsbHelp.Image = global::Tools.Properties.Resources.使用说明;
this.tsbHelp.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbHelp.Name = "tsbHelp";
this.tsbHelp.Size = new System.Drawing.Size(76, 21);
this.tsbHelp.Text = "使用说明";
//
// wDBTools // wDBTools
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......
...@@ -372,6 +372,12 @@ namespace Tools.UI ...@@ -372,6 +372,12 @@ namespace Tools.UI
/// <returns></returns> /// <returns></returns>
private bool CheckDetail() private bool CheckDetail()
{ {
//检查数据库链接
if (string.IsNullOrEmpty(this._link) || !this._db.ConnectionTest(this._link))
{
Utils.Tip("数据库链接无效,请选择有效链接!");
return false;
}
//检查表名 //检查表名
if (this.TableName.Equals("")) if (this.TableName.Equals(""))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment