title: How to update MS Access Database (vb.net)
body: <p>I am created a journal program for an internship project and I am using a MS-Access Database. I am programming in <strong>VB.net</strong>. Now, I am trying to make it so that they can "Update" their journals, meaning that they click on their calendar date and it brings them to that journal if they have one for that date. If they have one for that date then it shows the title and journal text entry for that date. I want to make it so that any changes they have made to the journal (editing the textbox fields) are also changed in the database when they click the update button. Here's what i have so far</p>
  
  <pre><code>    Private Sub COE_JournalBtn_Click(sender As System.Object, e As System.EventArgs) Handles COE_JournalBtn.Click
  
      If DateTimePicker1.Value &lt;&gt; Nothing Then
  
          If TitleTxt.Text &lt;&gt; "" Then
  
              If JournalTextRtxt.Text &lt;&gt; "" Then
  
                  myConnection.Open()
  
                  Dim DatePicked As String = DateTimePicker1.Value
                  Dim cmd As OleDbCommand
                  Dim str As String
  
                  Try
  
                      MyJournalTitle = TitleTxt.Text
                      MyJournalText = JournalTextRtxt.Text
  
                      str = "UPDATE Journals SET JournalTitle='" &amp; MyJournalTitle &amp; "', JournalText='" &amp; MyJournalText &amp; "' WHERE JournalDate=" &amp; DatePicked
  
                      cmd = New OleDbCommand(str, myConnection)
  
                      cmd.ExecuteNonQuery()
  
                      myConnection.Close()
  
                  Catch ex As Exception
  
                      MessageBox.Show("There was an error processing your request. Please try again." &amp; vbCrLf &amp; vbCrLf &amp; _
                                      "Original Error:" &amp; vbCrLf &amp; vbCrLf &amp; ex.ToString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  
                      myConnection.Close()
  
                  End Try
  
                  myConnection.Close()
  
              End If
  
          End If
  
      End If
  
  End Sub
  </code></pre>
  
  <p>Now my update string by itself is</p>
  
  <pre><code>"UPDATE Journals SET JournalTitle='" &amp; MyJournalTitle &amp; "', JournalText='" &amp; MyJournalText &amp; "' WHERE JournalDate=" &amp; DatePicked
  </code></pre>
  
  <p>Now, what happens, is absolutely nothing. No errorboxes come up. No messageboxes appear. The program doesn't freeze. And the database remains unchanged. What am I doing wrong? Is there an error in my code or something missing? Please help me because I really want to figure this out and i've been looking everywhere for a solution in VB.net and cannot find one that applies to me being that I am using MS-Access and NOT SQL.</p>
  
  <p>Thanks in advance,
  Richard Paulicelli</p>