以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]动态设置外部数据源打开窗口问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=185539) |
-- 作者:xiaochongsm97 -- 发布时间:2023/2/28 21:30:00 -- [求助]动态设置外部数据源打开窗口问题 本人动态设置了外部数据源字符串后,无任何报错,但是在“AfterOpenProject”事件中设置了打开窗口命令,在动态设置数据源之前,可以正常打开,但是设置以后,系统就打不开了,不知道是什么原因? |
-- 作者:有点蓝 -- 发布时间:2023/2/28 21:47:00 -- 代码?http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=150626 |
-- 作者:xiaochongsm97 -- 发布时间:2023/3/1 8:15:00 -- BeforeConnectOuterDataSource事件中的代码: Dim inifile As String = "xjgl.ini" Dim T_ini As New INIClass( ApplicationPath & inifile) Dim Provide As String Dim Persist_Security_Info As String Dim User As String Dim pwd As String Dim Initial_Catalog As String Dim Data_Source As String Dim Extended_Properties As String Dim Initial_File_Name As String Dim Server_SPN As String Dim dbconnectstring As String If T_ini.ExistINIFile Then Provide = T_ini.IniReadValue("data", "Provider") Persist_Security_Info = T_ini.IniReadValue("data", "Persist_Security_Info") User = T_ini.IniReadValue("data", "User") pwd = T_ini.IniReadValue("data", "pwd") Initial_Catalog = T_ini.IniReadValue("data", "Initial_Catalog") Data_Source = T_ini.IniReadValue("data", "Data_Source") Extended_Properties = T_ini.IniReadValue("data", "Extended_Properties") Initial_File_Name = T_ini.IniReadValue("data", "Initial_File_Name") Server_SPN = T_ini.IniReadValue("data", "Server_SPN") dbc & Provide & ";Persist Security Info=" & Persist_Security_Info & ";User ID=" & User & ";pwd=" & pwd & ";Initial Catalog=" & Initial_Catalog & ";Data Source=" & Data_Source & ";Extended Properties=""" & Extended_Properties & """;Initial File Name=""" & Initial_File_Name & """;Server SPN=""" & Server_SPN & "" e.ConnectionString = dbconnectstring Else MessageBox.Show( "" & inifile & "INI配置文件不存在,请确定", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop) Syscmd.Project.Exit End If AfterOpenProject事件内代码 Forms("窗口_系统登录").Open 编译软件,打开程序,加载splash界面可以,然后就退出了 |
-- 作者:有点蓝 -- 发布时间:2023/3/1 8:40:00 -- 调试看看MessageBox.Show能不能弹出来 …… dbconnectstring = dbconnectstring & Provide & ";Persist Security Info=" & Persist_Security_Info & ";User ID=" & User & ";pwd=" & pwd & ";Initial Catalog=" & Initial_Catalog & ";Data Source=" & Data_Source & ";Extended Properties=""" & Extended_Properties & """;Initial File Name=""" & Initial_File_Name & """;Server SPN=""" & Server_SPN & "" e.ConnectionString = dbconnectstring MessageBox.Show(dbconnectstring) Else MessageBox.Show( "" & inifile & "INI配置文件不存在,请确定", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop) Syscmd.Project.Exit End If AfterOpenProject事件内代码 MessageBox.Show("1") Forms("窗口_系统登录").Open [此贴子已经被作者于2023/3/1 8:41:05编辑过]
|
-- 作者:xiaochongsm97 -- 发布时间:2023/3/1 8:49:00 -- dbconnectstring = dbconnectstring & Provide & ";Persist Security Info=" & Persist_Security_Info & ";User ID=" & User & ";pwd=" & pwd & ";Initial Catalog=" & Initial_Catalog & ";Data Source=" & Data_Source & ";Extended Properties=""" & Extended_Properties & """;Initial File Name=""" & Initial_File_Name & """;Server SPN=""" & Server_SPN & "" e.ConnectionString = dbconnectstring MessageBox.Show(dbconnectstring)--------------第一处 Else MessageBox.Show( "" & inifile & "INI配置文件不存在,请确定", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop) Syscmd.Project.Exit End If 程序发布后,在第一处可以启动splash界面可以填出messagebox 窗口 但是 AfterOpenProject事件内代码 MessageBox.Show("1")-------------------第二处 在第二处的messagebox弹出窗口不显示 |
-- 作者:有点蓝 -- 发布时间:2023/3/1 8:55:00 -- 把MessageBox.Show(dbconnectstring)这里的链接字符串直接到数据源设置里添加一个数据源看能不能连接数据库? |
-- 作者:xiaochongsm97 -- 发布时间:2023/3/1 10:58:00 -- 最后发现不能通过变量问题; |