Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Ftt_Common
Commits
51d7ec15
Commit
51d7ec15
authored
Aug 11, 2021
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、表开发工具优化:适配所有表的说明维护需要;表名增加回车加载表信息和Alt+F8快捷键支持
parent
db8f153d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
50 deletions
+82
-50
Tools.exe.config
AppHome/Tools.exe.config
+1
-1
dbtools_help.txt
AppHome/config/help/dbtools_help.txt
+6
-5
wDBTableDevelopTools.Designer.cs
Tools/UI/wDBTableDevelopTools.Designer.cs
+16
-31
wDBTableDevelopTools.cs
Tools/UI/wDBTableDevelopTools.cs
+59
-13
No files found.
AppHome/Tools.exe.config
View file @
51d7ec15
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
appSettings
>
<
add
key
=
"UpdateTime"
value
=
"2021-07-29 1
4:12:41.660
"
/>
<
add
key
=
"UpdateTime"
value
=
"2021-07-29 1
8:01:08.283
"
/>
</
appSettings
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.8"
/>
...
...
AppHome/config/help/dbtools_help.txt
View file @
51d7ec15
使用说明:
1、配置说明:可设置默认数据库路径和默认导出路径
2、操作说明:支持右键増行/删行,以及按键Insert与Delete
3、导出文件:以表名命名,
即每表导出一个相应类型
文件。默认导出路径为temp,可自定义。
4、暂存与恢复:暂存
时,每表每天只暂存一个文件。暂存路径
根目录save文件夹。
3、导出文件:以表名命名,
相同类型多次导出则覆盖前面
文件。默认导出路径为temp,可自定义。
4、暂存与恢复:暂存
界面录入信息,可通过恢复暂存恢复。按表名暂存,每表每日只暂存一个文件。暂存路径为
根目录save文件夹。
5、数据库设置:快速设置数据库链接并记录历史设置。程序启动时读取配置文件的默认数据库链接。
6、加载表信息:表创建后,可以输入表名,通过该按钮加载相应信息。使用该功能时,有几点需要注意:
a.加载信息后,通过导出SQL按钮,会更新数据库的描述信息,除描述信息之外的任何修改不会更新到数据库。
b.由于类型是下拉选择框,对于非本工具创建的表,存在类型风险,即无法找到匹配的下拉项。
6、加载表信息:输入表名后:回车、点击工具栏-加载表信息、Alt+F8选择相似,都可以加载相关列信息
7、注意事项:
a.当表首次创建时,通过导出文件->生成SQL,会自动创建并记录描述信息
b.当表已存在时,通过导出文件->生成SQL,仅会更新描述信息
Tools/UI/wDBTableDevelopTools.Designer.cs
View file @
51d7ec15
...
...
@@ -50,7 +50,7 @@
this
.
dgvData
=
new
System
.
Windows
.
Forms
.
DataGridView
();
this
.
Column1
=
new
System
.
Windows
.
Forms
.
DataGridViewTextBoxColumn
();
this
.
Column6
=
new
System
.
Windows
.
Forms
.
DataGridViewTextBoxColumn
();
this
.
Column2
=
new
System
.
Windows
.
Forms
.
DataGridView
Combo
BoxColumn
();
this
.
Column2
=
new
System
.
Windows
.
Forms
.
DataGridView
Text
BoxColumn
();
this
.
Column3
=
new
System
.
Windows
.
Forms
.
DataGridViewCheckBoxColumn
();
this
.
Column4
=
new
System
.
Windows
.
Forms
.
DataGridViewCheckBoxColumn
();
this
.
Column7
=
new
System
.
Windows
.
Forms
.
DataGridViewCheckBoxColumn
();
...
...
@@ -252,23 +252,8 @@
//
this
.
Column2
.
DataPropertyName
=
"ColumnType"
;
this
.
Column2
.
HeaderText
=
"类型"
;
this
.
Column2
.
Items
.
AddRange
(
new
object
[]
{
""
,
"INT"
,
"VARCHAR(50)"
,
"DATETIME"
,
"IMAGE"
,
"BIT"
,
"VARCHAR(MAX)"
,
"UNIQUEIDENTIFIER"
,
"DECIMAL(19,6)"
,
"DECIMAL(18,2)"
,
"FLOAT"
,
"NVARCHAR(50)"
,
"NVARCHAR(MAX)"
});
this
.
Column2
.
Name
=
"Column2"
;
this
.
Column2
.
Resizable
=
System
.
Windows
.
Forms
.
DataGridViewTriState
.
True
;
this
.
Column2
.
SortMode
=
System
.
Windows
.
Forms
.
DataGridViewColumnSortMode
.
Automatic
;
this
.
Column2
.
Width
=
150
;
//
// Column3
...
...
@@ -325,13 +310,13 @@
//
this
.
tableLayoutPanel1
.
ColumnCount
=
8
;
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
75F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
25
F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
40
F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
75F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
25
F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
7
5F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
2
5F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
7
5F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
2
5F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
40
F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
5F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
5F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
5F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
5F
));
this
.
tableLayoutPanel1
.
Controls
.
Add
(
this
.
dgvData
,
0
,
1
);
this
.
tableLayoutPanel1
.
Controls
.
Add
(
this
.
label1
,
0
,
0
);
this
.
tableLayoutPanel1
.
Controls
.
Add
(
this
.
label2
,
2
,
0
);
...
...
@@ -360,7 +345,7 @@
// label2
//
this
.
label2
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
236
,
0
);
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
391
,
0
);
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
69
,
27
);
this
.
label2
.
TabIndex
=
3
;
...
...
@@ -372,15 +357,15 @@
this
.
tbTableName
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
tbTableName
.
Location
=
new
System
.
Drawing
.
Point
(
78
,
3
);
this
.
tbTableName
.
Name
=
"tbTableName"
;
this
.
tbTableName
.
Size
=
new
System
.
Drawing
.
Size
(
152
,
23
);
this
.
tbTableName
.
Size
=
new
System
.
Drawing
.
Size
(
307
,
23
);
this
.
tbTableName
.
TabIndex
=
4
;
//
// tbTableDescription
//
this
.
tbTableDescription
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
tbTableDescription
.
Location
=
new
System
.
Drawing
.
Point
(
311
,
3
);
this
.
tbTableDescription
.
Location
=
new
System
.
Drawing
.
Point
(
466
,
3
);
this
.
tbTableDescription
.
Name
=
"tbTableDescription"
;
this
.
tbTableDescription
.
Size
=
new
System
.
Drawing
.
Size
(
152
,
23
);
this
.
tbTableDescription
.
Size
=
new
System
.
Drawing
.
Size
(
307
,
23
);
this
.
tbTableDescription
.
TabIndex
=
5
;
//
// wDBTableDevelopTools
...
...
@@ -431,16 +416,16 @@
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbDbLink
;
private
System
.
Windows
.
Forms
.
ToolStripTextBox
tstbDbLink
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator3
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator4
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbLoadTable
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator5
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbSysSetting
;
private
System
.
Windows
.
Forms
.
DataGridViewTextBoxColumn
Column1
;
private
System
.
Windows
.
Forms
.
DataGridViewTextBoxColumn
Column6
;
private
System
.
Windows
.
Forms
.
DataGridView
Combo
BoxColumn
Column2
;
private
System
.
Windows
.
Forms
.
DataGridView
Text
BoxColumn
Column2
;
private
System
.
Windows
.
Forms
.
DataGridViewCheckBoxColumn
Column3
;
private
System
.
Windows
.
Forms
.
DataGridViewCheckBoxColumn
Column4
;
private
System
.
Windows
.
Forms
.
DataGridViewCheckBoxColumn
Column7
;
private
System
.
Windows
.
Forms
.
DataGridViewTextBoxColumn
Column5
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator4
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbLoadTable
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator5
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbSysSetting
;
}
}
\ No newline at end of file
Tools/UI/wDBTableDevelopTools.cs
View file @
51d7ec15
...
...
@@ -138,8 +138,10 @@ namespace Tools.UI
//上下文菜单-事件
this
.
tsmiAddRow
.
Click
+=
TsmiAddRow_Click
;
this
.
tsmiDelRow
.
Click
+=
TsmiDelRow_Click
;
//文本框-事件
this
.
tbTableName
.
KeyDown
+=
TbTableName_KeyDown
;
}
private
void
BindBaseInfo
()
{
this
.
tbTableName
.
DataBindings
.
Clear
();
...
...
@@ -263,16 +265,6 @@ namespace Tools.UI
private
void
TsbLoadTable_Click
(
object
sender
,
EventArgs
e
)
{
if
(
this
.
TableName
.
Equals
(
""
))
{
Utils
.
Tip
(
"请输入表名!"
);
return
;
}
if
(!
this
.
IsExistTable
(
this
.
TableName
))
{
Utils
.
Tip
(
"该表尚未创建!"
);
return
;
}
//初始化表列信息
this
.
InitTableColumnInfo
(
this
.
TableName
);
}
...
...
@@ -328,7 +320,7 @@ namespace Tools.UI
}
#
endregion
#
region
上下文
-
事件
#
region
上下文
菜单
-
事件
private
void
TsmiAddRow_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -344,6 +336,47 @@ namespace Tools.UI
}
}
#
endregion
#
region
文本框
-
事件
private
void
TbTableName_KeyDown
(
object
sender
,
KeyEventArgs
e
)
{
if
(
e
.
KeyCode
==
Keys
.
Enter
)
{
//初始化表列信息
this
.
InitTableColumnInfo
(
this
.
TableName
);
}
else
if
(
e
.
KeyData
==
(
Keys
.
Alt
|
Keys
.
F8
))
{
this
.
ShowMenuTips
();
}
}
//提供Alt+F8的提示功能
ContextMenu
_menu
=
new
ContextMenu
();
private
void
ShowMenuTips
()
{
this
.
_menu
.
MenuItems
.
Clear
();
var
sql
=
$"SELECT name FROM sys.tables WHERE name LIKE '
{
this
.
TableName
}
%' ORDER BY name"
;
var
dt
=
this
.
_db
.
GetDataTable
(
sql
,
"sys_tables"
,
false
);
if
(
dt
.
Rows
.
Count
>
0
)
{
var
items
=
dt
.
Select
().
AsEnumerable
().
Select
(
r
=>
new
MenuItem
(
r
[
"name"
].
ToString
(),
Item_Click
));
this
.
_menu
.
MenuItems
.
AddRange
(
items
.
ToArray
());
this
.
_menu
.
Show
(
this
.
tbTableName
,
new
Point
(
0
,
this
.
tbTableName
.
Height
));
}
else
{
Utils
.
Tip
(
$"当前数据库中不存在,与'
{
this
.
TableName
}
%'相似的表!"
);
}
}
private
void
Item_Click
(
object
sender
,
EventArgs
e
)
{
var
item
=
sender
as
MenuItem
;
this
.
tbTableName
.
Text
=
item
.
Text
;
this
.
InitTableColumnInfo
(
item
.
Text
);
}
#
endregion
/// <summary>
...
...
@@ -501,8 +534,20 @@ namespace Tools.UI
/// <param name="tableName"></param>
private
void
InitTableColumnInfo
(
string
tableName
)
{
//空值校验
if
(
string
.
IsNullOrEmpty
(
tableName
))
{
Utils
.
Tip
(
"请输入表名!"
);
return
;
}
//清空当前表格
this
.
_ds
.
Tables
[
infoTable
].
Rows
.
Clear
();
//是否存在
if
(!
this
.
IsExistTable
(
tableName
))
{
Utils
.
Tip
(
"该表尚未创建!"
);
return
;
}
var
sqlist
=
new
List
<
TQuery
>
{
//取表结构
...
...
@@ -558,10 +603,11 @@ namespace Tools.UI
}
}
#
region
待开发:支持查询后修改指定列类型列名等
#
endregion
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment