1

I created a serverless database (SQLite) and i can successfully read and write on it when the db is stored locally.

ImpersonationHelper.Impersonate(domain, userName, userPassword, delegate

{ try { if (System.IO.File.Exists(GlobalVar.NetworkPath)) {

        SQLiteCommand cmd;
        sqlite.Open();  //Initiate connection to the db
        cmd = sqlite.CreateCommand();
        sqlite.Close();
        picConnectionStatus.Image = Properties.Resources.icons8_database_view_64;
        lblConnectionEstablished.Text = "Connection Established";
    }
}
catch (Exception ex)
{
    picConnectionStatus.Image = Properties.Resources.icons8_delete_database_64;
    lblConnectionEstablished.Text = "Connection Error";
    lblConnectionEstablished.ForeColor = System.Drawing.Color.Red;
}

});

When I store the database to a shared folder i can not access it, probably because i have to provide credentials. i created the class as descripted on that topic and tryed also @Pavel Kovalev's solution with no success, i didn’t manage to use it in this case scenario - How to provide user name and password when connecting to a network share. Any suggestion?

vatech696
  • 31
  • 3
  • As you should have already guessed from the link provided and the answers there there are multiple ways to do it often depending on context so there is no "the solution". Is this a simple executable you are talking about or a service. Is the network share in your domain, another domain or no domain? – Ralf May 09 '22 at 12:25
  • And something common for in-process serverless database. They are normally not recommended to be used with network shares because of performance and especially reliability issues. – Ralf May 09 '22 at 12:27
  • its an other PC on a local network. \\Networkname\sharedFolder. I implemented the class and i set the above code within the call ImpersonationHelper.Impersonate(domain, userName, userPassword, delegate { //connect and read database }); I am new in coding so somewhere lost it – vatech696 May 09 '22 at 12:29

0 Answers0