Note that there are some explanatory texts on larger screens.

plurals
  1. POOleDbException: Missing semicolon (;) at end of SQL statement
    text
    copied!<p>I got an OleDbException saying that "Missing semicolon (;) at end of SQL statement." I got confused if the UPDATE statement is correct or not. In my code, I test the update statement using a button. Can anyone help me? I want to add 1 to the variable in order to increase its value; number of bottles. I am using Microsoft Access Database. Primary id is ID then Unique is room_number.</p> <p>This is my Code:</p> <pre><code>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '====test number of bottles============= Dim bottlecount As Integer 'variable used in order to increase the value of no. of bottle/s used bottlecount = Form3.lblBottle.Text bottlecount += 1 Form3.lblBottle.Text = bottlecount roomhold = 1 Dim statement As String = "UPDATE tblPatientInfo SET bottle_used='" &amp; bottlecount &amp; "' WHERE room_number= '" &amp; roomhold &amp; "' ORDER BY ID ;" Dim cmd As New OleDbCommand With cmd .CommandText = statement .Connection = Conn Conn.Open() .ExecuteNonQuery() End With Conn.Close() End Sub </code></pre> <p>===after applying the changes========== This is my code:</p> <pre><code> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim bottlecount As Integer = CInt(Form3.lblBottle.Text) + 1 Form3.lblBottle.Text = bottlecount roomhold = 1 Dim statement As String = "UPDATE tblPatientInfo SET bottle_used = @bottlecount" statement &amp;= "WHERE room_number = @roomhold" Dim cmd As New OleDbCommand With cmd .Connection = Conn .CommandType = CommandType.Text .CommandText = statement .Parameters.AddWithValue("@bottlecount", bottlecount) .Parameters.AddWithValue("@roomhold", roomhold) Conn.Open() .ExecuteNonQuery() End With </code></pre> <h1> Conn.Close()</h1> <p>Any help would be appreciated. Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload