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
5f62e208
Commit
5f62e208
authored
Dec 30, 2021
by
段廷瑞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://192.168.1.181/root/Ftt_Common
parents
563e385a
4ad24f61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
frmMain.cs
UpdateExecuter/frmMain.cs
+8
-1
No files found.
UpdateExecuter/frmMain.cs
View file @
5f62e208
...
@@ -327,6 +327,7 @@ namespace UpdateExecuter
...
@@ -327,6 +327,7 @@ namespace UpdateExecuter
{
{
FileInfo
_execFile
=
null
;
FileInfo
_execFile
=
null
;
string
_execSql
=
""
;
string
_execSql
=
""
;
var
configDbName
=
""
;
// 链接中配置的库。
try
try
{
{
ShowFileInfo
(
$"在客户[
{
client
}
]执行脚本……"
,
null
,
true
);
ShowFileInfo
(
$"在客户[
{
client
}
]执行脚本……"
,
null
,
true
);
...
@@ -335,10 +336,16 @@ namespace UpdateExecuter
...
@@ -335,10 +336,16 @@ namespace UpdateExecuter
{
{
using
(
SqlConnection
conn
=
new
SqlConnection
(
strConn
))
using
(
SqlConnection
conn
=
new
SqlConnection
(
strConn
))
{
{
//部分脚本文件可能会使用Use Ftt,如果后面执行的脚本文件中没有显示Use DB 则都虎被执行到Ftt。需要先取一下链接中配置的库,在每个脚本文件执行之前都执行一下切换动作,切换到配置的库。
if
(
string
.
IsNullOrEmpty
(
configDbName
))
configDbName
=
SqlHelper
.
ExecuteScalar
(
conn
,
CommandType
.
Text
,
"Select Db_Name();"
).
ToString
();
// 按顺序逐个文件执行,可保证脚本之间的依赖关系
// 按顺序逐个文件执行,可保证脚本之间的依赖关系
Array
.
ForEach
(
files
,
new
Action
<
FileInfo
>(
delegate
(
FileInfo
file
)
Array
.
ForEach
(
files
,
new
Action
<
FileInfo
>(
delegate
(
FileInfo
file
)
{
{
_execFile
=
file
;
// 执行环境切换到默认库。
SqlHelper
.
ExecuteNonQuery
(
conn
,
CommandType
.
Text
,
$"USE
{
configDbName
}
;"
);
_execFile
=
file
;
ShowFileInfo
(
$"在客户[
{
client
}
]执行脚本文件:
{
file
.
Name
}
."
,
file
,
true
);
ShowFileInfo
(
$"在客户[
{
client
}
]执行脚本文件:
{
file
.
Name
}
."
,
file
,
true
);
...
...
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