Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:35:43+00:00 2026-06-15T08:35:43+00:00

I am getting a cannot open exception when I try to do multiple updates

  • 0

I am getting a “cannot open” exception when I try to do multiple updates on the same table in the same transaction on SQLite in WinRT.

I have created a sample application for this use case. Below is code where on clicking the first button, I am creating a table in a transaction, and on clicking the other button, I am trying to update the same record a second time. There, it throws a “cannot open” exception.

app code:

private SQLiteConnection getConnection()
{
    var connection = SQLiteConnectionPool.Shared.GetConnection(
                           new SQLiteConnectionString("sample.db", false));
    return connection;
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
    SQLiteConnection con = getConnection();
    con.BeginTransaction();
    {
        try
        {
            var command = new SQLiteCommand(con) {
                CommandText =
                    @"create table konysyncMETAINFO (
                        id bigint not null,
                        versionnumber int,
                        lastserversynccontext nvarchar(1000),
                        filtervalue nvarchar(1000),
                        replaysequencenumber integer,
                        lastgeneratedid integer,
                        scopename nvarchar(100),
                        primary key (id))"
            };
            var xyz = (double)command.ExecuteNonQuery();

            var command2 = new SQLiteCommand(con) {
                CommandText =
                    @"insert into konysyncMETAINFO
                        (id,scopename,versionnumber,lastserversynccontext,
                         replaysequencenumber,lastgeneratedid)
                      values ('1','testscope','0','','0','-1')"
            };
            var xyz2 = (double)command2.ExecuteNonQuery();

            var command3 = new SQLiteCommand(con) {
                CommandText =
                    @"insert into konysyncMETAINFO
                        (id,scopename,versionnumber,lastserversynccontext,
                         replaysequencenumber,lastgeneratedid)
                      values ('2','testscope2','0','','0','-1')"
            };
            var xyz3 = (double)command3.ExecuteNonQuery();
            con.Commit();
        }
        catch (Exception ex)
        {
            con.Rollback();
        }
    }
}

private void Button_Click_2(object sender, RoutedEventArgs e)
{
    SQLiteConnection con = getConnection();
    con.BeginTransaction();
    {
        try
        {
            var command = new SQLiteCommand(con) {
                CommandText =
                    @"Update konysyncMETAINFO
                      set lastgeneratedid='4'
                      WHERE scopename = 'testscope'"
            };
            var xyz = (double)command.ExecuteNonQuery();

            //var command2 = new SQLiteCommand(con) { CommandText = "insert into konysyncMETAINFO (id,scopename,versionnumber,lastserversynccontext,replaysequencenumber,lastgeneratedid) values ('3','testscope3','0','','0','-1')" };
            //var xyz2 = (double)command2.ExecuteNonQuery();

            var command3 = new SQLiteCommand(con) {
                CommandText =
                    @"Update konysyncMETAINFO 
                      set lastgeneratedid='3'
                      WHERE scopename = 'testscope'"
            };
            var xyz3 = (double)command3.ExecuteNonQuery();
            con.Commit();
        }
        catch (Exception ex)
        {
            con.Rollback();
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:35:44+00:00Added an answer on June 15, 2026 at 8:35 am

    You’ve probably stumbled across the same bug in sqlite-net that I have. I’ve created a fix which has already been pulled back into the main fork but there hasn’t been a new release on NuGet since then. You could download the latest sources directly and check if it fixes your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am getting an exception thrown that my Test project cannot open the
The error I am getting is Cannot open database NerdlyDB requested by the login.
I cannot understand why I am getting deadlock in this simple sample.What is wrong
I'm getting an exception when I try to run my application (in eclipse) complaining
I am getting this error when I try to open a file: java.io.FileNotFoundException: D:\Portable%20Programs\Android%20Development\workspace3\XXX-desktop\bin\World_X.fr
I am getting following exception file :: Result000691.dat java.io.FileNotFoundException: D:\bio-rad\Result000691.dat (The process cannot access
I am getting an error at my aConnection.Open() line and cannot figure out why.
I'm getting an exception thrown at reader = cmd.ExecuteReader(); when I debug. CS0266: Cannot
I am getting a Cannot Find Symbol error for rowData, and columnLabels. Is the
I'm trying to convert integer data to string , but I'm getting error cannot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.