diff --git a/Img/docImg/chmd.png b/Img/docImg/chmd.png new file mode 100644 index 0000000000000000000000000000000000000000..17879bf11d59217b7e742ba669cd9bb50d21c2f2 Binary files /dev/null and b/Img/docImg/chmd.png differ diff --git a/README.md b/README.md index be7df05474af1d5291461dc028686fa9be025b39..3dbeea96d65d5bf66ea7d8d68d3c822d828bf664 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
SmartSQL -

SmartSQL

+

SmartSQL

⚡一款方便、快捷的数据库文档查询、生成工具
@@ -88,7 +88,9 @@ SmartSQL 是一款方便、快捷的数据库文档查询、导出工具!该 ### 🎉 五、文档截图 #### 1.CHM文档 -![CHM文档](https://gitee.com/izhaofu/SmartSQL/raw/master/Img/docImg/chm.png) +||| +|--|--| +|![CHM文档](https://gitee.com/izhaofu/SmartSQL/raw/master/Img/docImg/chm.png)|![CHM文档](https://gitee.com/izhaofu/SmartSQL/raw/master/Img/docImg/chmd.png)| #### 2.HTML文档 ||| diff --git a/SmartSQL/SmartSQL/App.xaml.cs b/SmartSQL/SmartSQL/App.xaml.cs index 4b44aec8d4f6d2e445994fa8699087f8e997fc1e..0690f05df1fa198b666d5185c3a9e8b6cf7b4f3b 100644 --- a/SmartSQL/SmartSQL/App.xaml.cs +++ b/SmartSQL/SmartSQL/App.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -37,38 +37,40 @@ namespace SmartSQL try { e.Handled = true; //把 Handled 属性设为true,表示此异常已处理,程序可以继续运行,不会强制退出 - Growl.WarningGlobal("UI线程异常:" + e.Exception); + //Growl.WarningGlobal("UI线程异常:" + e.Exception); + Growl.WarningGlobal("程序异常,请稍后再试"); } catch (Exception) { //此时程序出现严重异常,将强制结束退出 - Growl.WarningGlobal("UI线程发生致命错误"); + Growl.WarningGlobal("程序异常,请稍后再试"); } } void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { - StringBuilder sbEx = new StringBuilder(); - if (e.IsTerminating) - { - sbEx.Append("非UI线程发生致命错误:"); - } - sbEx.Append("非UI线程异常:"); - if (e.ExceptionObject is Exception) - { - sbEx.Append(((Exception)e.ExceptionObject).Message); - } - else - { - sbEx.Append(e.ExceptionObject); - } - Growl.WarningGlobal(sbEx.ToString()); + //StringBuilder sbEx = new StringBuilder(); + //if (e.IsTerminating) + //{ + // sbEx.Append("非UI线程发生致命错误:"); + //} + //sbEx.Append("非UI线程异常:"); + //if (e.ExceptionObject is Exception) + //{ + // sbEx.Append(((Exception)e.ExceptionObject).Message); + //} + //else + //{ + // sbEx.Append(e.ExceptionObject); + //} + Growl.WarningGlobal("程序异常,请稍后再试"); } void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) { //task线程内未处理捕获 - Growl.WarningGlobal("Task线程异常:" + e.Exception.Message); + //Growl.WarningGlobal("Task线程异常:" + e.Exception.Message); + Growl.WarningGlobal("程序异常,请稍后再试"); e.SetObserved();//设置该异常已察觉(这样处理后就不会引起程序崩溃) } } diff --git a/SmartSQL/SmartSQL/MainWindow.xaml.cs b/SmartSQL/SmartSQL/MainWindow.xaml.cs index 591fc3287c0fb1b9a0f4fede0a8e05cf1676afc5..45f9f29c85a3dc4d770e3b1f04c73b4d43750faa 100644 --- a/SmartSQL/SmartSQL/MainWindow.xaml.cs +++ b/SmartSQL/SmartSQL/MainWindow.xaml.cs @@ -286,10 +286,24 @@ namespace SmartSQL }).ToList(); } #endregion - - var dbInstance = ExporterFactory.CreateInstance(selectConnection.DbType, selectConnection.SelectedDbConnectString(selectDataBase)); - var model = dbInstance.Init(); - dataSource = model; + var model = new Model(); + try + { + var dbInstance = ExporterFactory.CreateInstance(selectConnection.DbType, selectConnection.SelectedDbConnectString(selectDataBase)); + model = dbInstance.Init(); + dataSource = model; + } + catch (Exception ex) + { + Dispatcher.BeginInvoke(new Action(() => + { + Growl.Warning(new GrowlInfo + { + Message = $"连接失败 {selectConnection.ConnectName},原因:" + ex.Message, ShowDateTime = false, + Type = InfoType.Error + }); + })); + } var textColor = "#333444"; #region 数据表 foreach (var table in model.Tables) diff --git a/SmartSQL/SmartSQL/Views/ConnectManage.xaml.cs b/SmartSQL/SmartSQL/Views/ConnectManage.xaml.cs index 49e67fb0f1c9c6e5945464344afdab3d6560f54f..21be7cdddd699663530d63fd61dd965d6e2d26a3 100644 --- a/SmartSQL/SmartSQL/Views/ConnectManage.xaml.cs +++ b/SmartSQL/SmartSQL/Views/ConnectManage.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -148,13 +148,15 @@ namespace SmartSQL.Views dbType = DbType.SqlServer; connectId = Convert.ToInt32(MsSql_HidId.Text); connectName = MsSql_TextConnectName.Text.Trim(); - serverAddress = MsSql_TextServerAddress.Text.Trim(); + serverAddress = MsSql_TextServerAddress.Text.Trim().Equals(".") + ? $"." + : $"{MsSql_TextServerAddress.Text.Trim()},{MsSql_TextServerPort.Value}"; serverPort = MsSql_TextServerPort.Value; authentication = MsSql_ComboAuthentication.SelectedValue == SQLServer ? 1 : 0; userName = MsSql_TextServerName.Text.Trim(); password = MsSql_TextServerPassword.Password.Trim(); defaultDataBase = (DataBase)MsSql_ComboDefaultDatabase.SelectedItem; - connectionString = $"server={serverAddress},{serverPort};" + + connectionString = $"server={serverAddress};" + $"database=master;uid={userName};" + $"pwd={password};"; }