0

Путь к базе данных

sden 4 ár síðan Uppfært 4 ár síðan 6

Здравствуйте! Как можно изменить путь к базе данных PortalLink.db3

Прописать в user.config

служебный каталог 

<setting name="LocalPath" serializeAs="String">

<value>C:\Инстер\ПорталЛинк\</value>

<setting/>

строка подключения к БД

<setting name="ConnectionStrings" serializeAs="Xml">

<value>

<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<string>Name=Legacy;Provider=SQLite;ConnectionParams="Data Source=C:\Инстер\ПорталЛинк\PortalLink.db3"</string>

</ArrayOfString>

</value>

<setting/>

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="Inster.PortalLink.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <userSettings>
        <Inster.PortalLink.Properties.Settings>
            <setting name="DefaultStreetTypeIndex" serializeAs="String">
                <value>82</value>
            </setting>
            <setting name="MainFormLocation" serializeAs="String">
                <value>50, 50</value>
            </setting>
            <setting name="MainFormState" serializeAs="String">
                <value>Normal</value>
            </setting>
            <setting name="MainFormSize" serializeAs="String">
                <value>1820, 950</value>
            </setting>
            <setting name="IsFirstRun" serializeAs="String">
                <value>False</value>
            </setting>
            <setting name="DefaultApartmentTypeIndex" serializeAs="String">
                <value>1</value>
            </setting>
            <setting name="DefaultHouseTypeIndex" serializeAs="String">
                <value>4</value>
            </setting>
            <setting name="DExplorerSplitterDistance" serializeAs="String">
                <value>684</value>
            </setting>
            <setting name="DefaultConnectionIndex" serializeAs="String">
                <value>0</value>
            </setting>
            <setting name="DefaultStructureTypeIndex" serializeAs="String">
                <value>3</value>
            </setting>
            <setting name="DefaultBuildingTypeIndex" serializeAs="String">
                <value>4</value>
            </setting>
        </Inster.PortalLink.Properties.Settings>
    </userSettings>
</configuration>
Куда вставлять строки?

Раздел <Inster.PortalLink.Properties.Settings>

после последнего </setting>

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="Inster.PortalLink.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <userSettings>
        <Inster.PortalLink.Properties.Settings>
            <setting name="DefaultStreetTypeIndex" serializeAs="String">
                <value>82</value>
            </setting>
            <setting name="MainFormLocation" serializeAs="String">
                <value>50, 50</value>
            </setting>
            <setting name="MainFormState" serializeAs="String">
                <value>Normal</value>
            </setting>
            <setting name="MainFormSize" serializeAs="String">
                <value>1820, 950</value>
            </setting>
            <setting name="IsFirstRun" serializeAs="String">
                <value>False</value>
            </setting>
            <setting name="DefaultApartmentTypeIndex" serializeAs="String">
                <value>1</value>
            </setting>
            <setting name="DefaultHouseTypeIndex" serializeAs="String">
                <value>4</value>
            </setting>
            <setting name="DExplorerSplitterDistance" serializeAs="String">
                <value>684</value>
            </setting>
            <setting name="DefaultConnectionIndex" serializeAs="String">
                <value>0</value>
            </setting>
            <setting name="DefaultStructureTypeIndex" serializeAs="String">
                <value>3</value>
            </setting>
            <setting name="DefaultBuildingTypeIndex" serializeAs="String">
                <value>4</value>
            </setting>
            <setting name="LocalPath" serializeAs="String">
                <value>C:\INSTER\</value>
            <setting/>
            <setting name="ConnectionStrings" serializeAs="Xml">
                <value>
            <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <string>Name=Legacy;Provider=SQLite;ConnectionParams="Data Source=C:\INSTER\PortalLink.db3"</string>
            </ArrayOfString>
                </value>
            <setting/>
        </Inster.PortalLink.Properties.Settings>
    </userSettings>
</configuration>
Пишет ошибку.

ошибка была - надо </setting>

Спасибо, работает!