Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15223

VS 2019 UPDATE Query Throws error "Database is locked". help!

$
0
0
Hello!

I'm having trouble with my UPDATE Query, I'm using an SQLite DB, it has a table called Brand_Table, this table has only 2 columns: [ID] and [Name]. I can INSERT and DELETE records from it, but updating is giving me a headache.
When I run my UPDATE Query it hangs for about 31 seconds then it throws this error:
Name:  01c.png
Views: 29
Size:  17.1 KB

I've been googling and checking lots of possible causes, but I found nothing to help in my particular scenario.
this my SQLite DB:
Name:  01a.png
Views: 35
Size:  6.0 KB
Name:  01.png
Views: 30
Size:  9.3 KB

This is my form:
Name:  01b.jpg
Views: 31
Size:  15.0 KB

And this my code:
VB.NET Code:
  1. Using connection_1 As New SQLiteConnection("Data Source=C:\WinMiniSuper\DB2\MiniSuper.db;Version=3;")
  2.             If (connection_1.State = ConnectionState.Closed) Then connection_1.Open()
  3.             Dim ID_Scalar As Integer = 0
  4.             Using Command1 As New SQLiteCommand("SELECT ID_ FROM Brand_Table WHERE Name = '" & ComboBox1.Text & "'", connection_1)
  5.                 ID_Scalar = Convert.ToInt32(Command1.ExecuteScalar())
  6.             End Using
  7.             Using Command2 As New SQLiteCommand("UPDATE Brand_Table SET Name = @TB1 WHERE ID_ = '" & ID_Scalar & "'", connection_1)
  8.                 Command2.Parameters.AddWithValue("@TB1", TextBox1.Text)
  9.                 Command2.ExecuteNonQuery()
  10.             End Using
  11.         End Using

I'll appreciate any help!

Thank you.
Attached Images
    

Viewing all articles
Browse latest Browse all 15223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>