<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="Citrus_Welding.My.MySettings.CitWeldConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\Citrus Welding\CitWeld.mdb""
providerName="System.Data.OleDb" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
我正在查看连接字符串,我需要数据源默认来自另一个页面的选定文件...我试过&amp; pagename.openfiledialog.filename&amp;但我不断收到错误。有什么想法吗?
答案 0 :(得分:0)
您似乎希望用户能够在运行时设置Data Source
。如果是,则从配置文件中的连接字符串中省略它,并在运行时将其设置为:
Dim builder As New OleDbConnectionStringBuilder(My.Settings.CitWeldConnectionString)
builder.DataSource = newDataSourceValue
Dim connection As New OleDbConnection(builder.ConnectionString)