none
Publishing a restored SQL DB using ClickOnce RRS feed

  • Question

  • I have developed a program that I want to publish and after a lot of research I think the simplest way is to Restore the database as part of the ClickOnce manifest.

    This is the link where the code I am using comes from:

    To test this I have found on a forum some code that demonstrates this.

    https://www.codeproject.com/Articles/127794/Restoring-SQL-Server-Express-2008-Database-with-Click-Once

    The first part is to create a class Library, called CreatingDB.
    When I typed this in there were numerous errors.
    Here is the code for the class file:

    using System.Data.SqlClient;
    using System.IO;
    using System.Security.AccessControl;
    using System.Windows.Forms;
    using Microsoft.SqlServer.Management.Common;
    using Microsoft.SqlServer.Management.Smo;
    
    
    namespace CreatingDB
    {
        [RunInstaller(true)]
        public partial class Installer1 : System.Configuration.Install.Installer
        {
            public Installer1()
            {
                InitializeComponent();
            }
    
            public void RestoreDatabase(String databaseName, String filePath, String serverName,
                String userName, String password, String dataFilePath, String logFilePath)
            {
                // Create Restore instance
                Restore sqlRestore = new Restore();
    
                // Point to database
                BackupDeviceItem deviceItem = new BackupDeviceItem(filePath, DeviceType.File);
                sqlRestore.Devices.Add(deviceItem);
                sqlRestore.Database = databaseName;
    
                // Connect to DB Server
                ServerConnection connection;
    
                if (userName == "") // for Windows Authentication
                {
                    SqlConnection sqlCon = new SqlConnection(@"Data Source=" + serverName + @"; 
    Integrated Security=True;");
                    connection = new ServerConnection(sqlCon);
                }
                else // for Server Authentication
                    connection = new ServerConnection(serverName, userName, password);
    
                // Restoring
                Server sqlServer = new Server(connection);
                Database db = sqlServer.Databases[databaseName];
                sqlRestore.Action = RestoreActionType.Database;
                String dataFileLocation = dataFilePath + databaseName + ".mdf";
                String logFileLocation = logFilePath + databaseName + "_Log.ldf";
                db = sqlServer.Databases[databaseName];
                RelocateFile rf = new RelocateFile(databaseName, dataFileLocation);
                sqlRestore.RelocateFiles.Add(new RelocateFile(databaseName, dataFileLocation));
                sqlRestore.RelocateFiles.Add(new RelocateFile(databaseName + "_log", logFileLocation));
                sqlRestore.ReplaceDatabase = true;
                sqlRestore.PercentCompleteNotification = 10;
    
                try
                {
                    sqlRestore.SqlRestore(sqlServer);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.InnerException.ToString());
                }
    
                db = sqlServer.Databases[databaseName];
                db.SetOnline();
                sqlServer.Refresh();
            }
    
            public override void Commit(System.Collections.IDictionary savedState)
            {
                // Required permission
                try
                {
                    DirectorySecurity dirSec = Directory.GetAccessControl(Context.Parameters["TargetDir"]);
                    FileSystemAccessRule fsar = new FileSystemAccessRule
                    (@"NT AUTHORITY\NETWORK SERVICE"
                    , FileSystemRights.FullControl
                    , InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit
                    , PropagationFlags.None
                    , AccessControlType.Allow);
                    dirSec.AddAccessRule(fsar);
                    Directory.SetAccessControl(Context.Parameters["TargetDir"], dirSec);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
    
                // Parameters that comes from setup project (CreatingDBSetup) 
                RestoreDatabase(Context.Parameters["databaseName"].ToString(),
                    Context.Parameters["filePath"].ToString(), Context.Parameters
                ["serverName"].ToString(), Context.Parameters["userName"].ToString(),
                    Context.Parameters["password"].ToString(), Context.Parameters
                ["dataFilePath"].ToString(), Context.Parameters["logFilePath"].ToString());
    
                base.Commit(savedState);
            }
        }
    }

    There are many errors listed below:

    Severity    Code    Description    Project    File    Line    Suppression State
    Error    CS0246    The type or namespace name 'RunInstallerAttribute' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    11    Active
    Error    CS0246    The type or namespace name 'RunInstaller' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    11    Active
    Error    CS0234    The type or namespace name 'Install' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    12    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    19    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    19    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    19    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    20    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    20    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    20    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    20    Active
    Error    CS0115    'Installer1.Commit(IDictionary)': no suitable method found to override    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    69    Active
    Error    CS0115    'Installer1.Dispose(bool)': no suitable method found to override    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.Designer.cs    14    Active
    Error    CS7069    "Reference to type 'SqlConnection' claims it is defined in 'System.Data', but it could not be found"    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    37    Active
    Error    CS1503    Argument 1: cannot convert from 'System.Data.SqlClient.SqlConnection' to 'Microsoft.SqlServer.Management.Common.SqlConnectionInfo'    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    37    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    46    Active
    Error    CS0246    The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    47    Active
    Error    CS0246    The type or namespace name 'Exception' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    59    Active
    Error    CS0246    The type or namespace name 'DirectorySecurity' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    74    Active
    Error    CS0117    'Directory' does not contain a definition for 'GetAccessControl'    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    74    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    74    Active
    Error    CS0246    The type or namespace name 'FileSystemAccessRule' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    75    Active
    Error    CS0246    The type or namespace name 'FileSystemAccessRule' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    75    Active
    Error    CS0103    The name 'FileSystemRights' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    77    Active
    Error    CS0117    'Directory' does not contain a definition for 'SetAccessControl'    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    82    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    82    Active
    Error    CS0246    The type or namespace name 'Exception' could not be found (are you missing a using directive or an assembly reference?)    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    84    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    90    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    91    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    91    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    92    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    93    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    93    Active
    Error    CS0103    The name 'Context' does not exist in the current context    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\Installer1.cs    94    Active
    Warning    NU1701    "Package 'Microsoft.SqlServer.Compact 4.0.8876.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project."    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\CreatingDB.csproj    1    
    Warning    NU1701    "Package 'SqlConnection 1.0.2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project."    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\CreatingDB.csproj    1    
    Warning    NU1701    "Package 'SQLConnectionStringUI 1.0.0.5' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project."    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\CreatingDB.csproj    1    
    Warning    NU1701    "Package 'Unofficial.Microsoft.SQLServer.SMO.2014 12.0.2000.8' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project."    CreatingDB    D:\Visual Basic Projects\ClickOnceSQL\CreatingDB\CreatingDB.csproj    1    
    Warning    MSB3290    "Failed to create the wrapper assembly for type library ""{215d64d2-031c-33c7-96e3-61794cd1ee61}"". Type library 'System_Windows_Forms' was exported from a CLR assembly and cannot be re-imported as a CLR assembly."    CreatingDB    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets    2729    

    I don't know why I am getting these errors.  Is it that there some file missing?


    TEH

    samedi 25 janvier 2020 16:38

Réponses

  • Hi,

    It is a Winforms project with C#. Please refer to this project sample

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marqué comme réponse Rocky48 mercredi 12 février 2020 14:32
    mercredi 12 février 2020 05:23
    Modérateur

Toutes les réponses

  • Hi Rocky48,

    When publish an application with database, I think using "SqlDb" is not a good choice. Because it is complicated to use it offline.

    Maybe you can try the "SQLite". You only need to include the corresponding "SQLite" file in the "Application File ..." when publishing the software.

    The following is the simple demo that use "SQLite".

    1. Install System.Data.SQLite using NuGet

    2. Configure the connection string in App.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    ...
      <connectionStrings>
         <add name="SQLiteDbContext" connectionString="Data Source=MyDatabase.sqlite" providerName="System.Data.SQLite.EF6" />
      </connectionStrings>
    </configuration>

    3. How to use

    // create
    SQLiteConnection.CreateFile("MyDatabase.sqlite");
    
    SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=MyDatabase.sqlite");
    m_dbConnection.Open();
    
    string sql = "create table highscores (name varchar(20), score int)";
    
    SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
    command.ExecuteNonQuery();
    
    sql = "insert into highscores (name, score) values ('Me', 9001)";
    
    command = new SQLiteCommand(sql, m_dbConnection);
    command.ExecuteNonQuery();// read
    SQLiteCommand sqlCom = new SQLiteCommand("Select * From highscores", m_dbConnection);
    
    SQLiteDataReader sqlDataReader = sqlCom.ExecuteReader();
    
    int i = 1;
    while (sqlDataReader.Read())
    {
        // ...
    }
    
    m_dbConnection.Close();

    Then the SQLite file will be generated in the folder "bin\Debug".

    Hope these can help you.

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    lundi 27 janvier 2020 02:04
    Modérateur
  • Just trying the above but something must be missing?

    Should there be a Class file for SQLite?

    I tried 'Using SQLite' and 'Using SQLite PCL' but they did not work.

    More information required to test this option.


    TEH

    mardi 28 janvier 2020 17:29
  • Hi Rocky48,

    Sorry for the delay. You need to add reference "using System.Data.SQLite;".

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    lundi 3 février 2020 03:35
    Modérateur
  • Got another error when I ran the code with the new Assembly:

     at sqlite_test.Program.Main() in C:\Users\tehud\source\repos\sqlite test\sqlite test\Program.cs:line 19

    Inner Exception 1:
    ConfigurationErrorsException: Configuration system failed to initialize

    Inner Exception 2:
    ConfigurationErrorsException: Unrecognized element. (C:\Users\tehud\source\repos\sqlite test\sqlite test\bin\Debug\sqlite test.exe.Config line 6)

    Here is the Config file where the error is:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
      ...
      <connectionStrings><add name="SQLiteDbContext" connectionString="Data Source=MyDatabase.sqlite" providerName="System.Data.SQLite.EF6" /></connectionStrings><entityFramework><providers><provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /><provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /></providers></entityFramework><system.data><DbProviderFactories><remove invariant="System.Data.SQLite.EF6" /><add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /><remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories></system.data><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Collections.Concurrent" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Collections" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.ComponentModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.ComponentModel.EventBasedAsync" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Data.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Diagnostics.Contracts" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Diagnostics.Debug" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Diagnostics.Tools" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Diagnostics.Tracing" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Dynamic.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Globalization" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Globalization.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Linq" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Linq.Expressions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Linq.Parallel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Linq.Queryable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.NetworkInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Requests" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Sockets" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.ObjectModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Reflection.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Reflection.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Resources.ResourceManager" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Numerics" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Serialization.Json" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Serialization.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Serialization.Xml" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Security.Principal" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Security.SecureString" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Text.Encoding.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Text.RegularExpressions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Overlapped" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Tasks.Parallel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Timer" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml.XmlSerializer" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding></runtime></configuration>


    TEH

    mardi 4 février 2020 16:01
  • Hi Rocky48,

    Sorry, I think this new issue has nothing to do with SQLite. I test the demo in my project, and it works fine. This should be caused by "new Assembly". So I suggest you create a new thread to ask it.

    One thread is only used to discuss one problem.

    Thank you for your understanding.

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    mercredi 5 février 2020 02:16
    Modérateur
  • Hi Kyle

    I think I may be running the progran incorrectly?

    What type of enviroment is the 'How to use' part written in?

    Is it VB?

    Is it a Windows forms App?

    If not what?

    I have only ever use Windows forms app, so unsure how to run this!


    TEH

    mardi 11 février 2020 17:34
  • Hi,

    It is a Winforms project with C#. Please refer to this project sample

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marqué comme réponse Rocky48 mercredi 12 février 2020 14:32
    mercredi 12 février 2020 05:23
    Modérateur