none
security modify database RRS feed

  • Question

  • Hi

    I have a local database and try to update it but I never modify it.

    Is there a key for the app to be able to do this?

    using SQLite universal app c#

    can the database be used modified without a certificate?

    Tuesday, January 16, 2018 4:03 PM

All replies

  • Hi Rui M_,

    According to your description, I am not sure what is the issue, could you please describe it in detail, do you use Linq to SQL to connect SQLite, which have password, or other?

    About SQLite connection string, you could refer to the following link.

    https://www.connectionstrings.com/sqlite/

    Best regards,

    Zhanglong


    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.

    Wednesday, January 17, 2018 1:18 AM
  • Hi

    I use this

    public class tempos2
            {
    
                [SQLite.Net.Attributes.PrimaryKey, SQLite.Net.Attributes.AutoIncrement]  
                //[SQLite.AutoIncrement, SQLite.PrimaryKey]
                //public int SQLite.PrimaryKey;
                public string nome { get; set; }
                public int objeto1n1 { get; set; }
    
            }


    using System.Data.SqlClient;

    and

    using MonoGame.Framework;

    I need to set a password or set it to nothing

    How?

    • Edited by Rui M_ Wednesday, January 17, 2018 5:53 AM question
    Wednesday, January 17, 2018 5:47 AM
  • Hi Rui M_,

    If you use SQLite, you need to download and install SQLite data provide to access SQLite Database.

    http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki

    Best regards,

    Zhanglong


    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.

    Wednesday, January 17, 2018 6:52 AM
  • Hi

    I did what you mentioned but I still can't do nothing (can't update the local database)

    This:

    var db2 = new SQLiteConnection(path);
    
                Debug.WriteLine(db2);
    
                Debug.WriteLine("resultadinho...................2");
    
                Debug.WriteLine(db2.CreateTable<tempos2>());
    
                Debug.WriteLine(db2.Query<tempos2>("INSERT INTO `tempos2`(nome,`objeto1n1`) VALUES (NULL,NULL);").FirstOrDefault());


    Gives the following output:

    1st writeline > SQLite.SQLiteConnection
    2nd writeline > resultadinho...................2
    'Game2Criancas.Windows.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Reflection.Extensions\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Reflection.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'Game2Criancas.Windows.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\Users\Rui\Desktop\Apps e net\UniversalApps\Game2Criancas\Game2Criancas\Game2Criancas.Windows\bin\x64\Debug\AppX\SQLite.Net.DLL'. Cannot find or open the PDB file.
    3rd writeline > 0

    4th writeline >    (returns nothing or an empty space and returns a new line for the debug)

    I think my problem is the way I create the table "tempos2"

    But if I change the 1st value of NULL to "nome", vs2013 complains informing that there is no column named "nome" (this in "tempos2")

    Wednesday, January 17, 2018 1:22 PM
  • Hi

    the problem is that the AppData folder is read only .... I need to set the path to the local directory.

    How can I do this using c# ?

    string path = Directory.GetCurrentDirectory();

    doesn't work....

    I have System.IO at the beginning of the file....


    Wednesday, January 17, 2018 3:20 PM
  • Now the path is ok but I get this debug info:

    objetostempos.db (CannotOpen)

    Why?

    Wednesday, January 17, 2018 5:58 PM
  • Hi Rui M_,

    Please use the following path and check if it works for you.

    string path= ApplicationData.Current.LocalFolder.Path

    For more information, please refer to:

    In addition, because your issue is more related to MonoGame.Framework, you could also post your issue MonoGame.Framework for suitable support.

    http://community.monogame.net/

    Linux on Azure

    Best regards,

    Zhanglong


    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.

    Thursday, January 18, 2018 2:41 AM
  • Hi

    If I use:

    string path = "ms-appx:///objetostempos.db";

    I get

    C:\Users\Rui\AppData\Local\Packages\f7b2d48f-f800-4e57-9cee-5907362702aa_phw3tmq2f2wzm\LocalState\ms-appx:///objetostempos.db (CannotOpen)

    If I use

    var path = "C:/Users/Rui/Desktop/Apps e net/UniversalApps/Game2Criancas/Game2Criancas/Game2Criancas.Windows/objetostempos.db";

    I get

    Could not open database file: C:/Users/Rui/Desktop/Apps e net/UniversalApps/Game2Criancas/Game2Criancas/Game2Criancas.Windows/objetostempos.db (CannotOpen)

    Summing up, with the complete path I find the database but can't open it....


    • Edited by Rui M_ Thursday, January 18, 2018 9:56 AM
    Thursday, January 18, 2018 9:56 AM
  • Now I'm using files.

    But don't have permission to open the file.

    byte[] encodedText = Encoding.Unicode.GetBytes("agora sim");
    
                using (FileStream sourceStream = new FileStream(path,
                    FileMode.Append, FileAccess.Write, FileShare.None,
                    bufferSize: 4096, useAsync: true))
                {
                    await sourceStream.WriteAsync(encodedText, 0, encodedText.Length);
                };

    Now I can't install System.IO.FileStream

    Because when I try to install .NETFramework, Version=v4.6.1

    it tells me I have another framework (more updated installed)

    How can I uninstall without any doubt, I ask

    Thursday, January 18, 2018 1:25 PM