Quantcast
Channel: VBForums - Database Development
Viewing all articles
Browse latest Browse all 2918

No changes accepted

$
0
0
Continued from this to[ic: http://www.vbforums.com/showthread.p...MM-dd-hh-mm-ss


Here's the code:

Code:

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click


        Dim labelTime As String = ConvertDt(lbldt.Text)

        Dim retval As Integer

        Try
            Dim ConnectionString As String = db_path
            Dim con As SQLite.SQLiteConnection = New SQLite.SQLiteConnection(ConnectionString)
            Dim cmd As SQLiteCommand = con.CreateCommand()
            cmd.CommandText = "UPDATE Items SET done = @done, work=@work  WHERE ID = @ID AND dt=@dt"

            con.Open()

            cmd.Parameters.AddWithValue("@done", chkdone.Checked)
            cmd.Parameters.AddWithValue("@work", txtwork.Text)
            cmd.Parameters.AddWithValue("@ID", Label3.Text)
            cmd.Parameters.AddWithValue("@dt", labelTime)

            Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
            con.Close()

            If chkdone.Checked = True Then : chkdone.Visible = False
            Else : chkdone.Visible = True : End If
                 
        Catch ex As Exception
            retval = MsgBox("Error: " & ex.ToString(), MsgBoxStyle.Critical + MsgBoxStyle.OkOnly)
        End Try

    End Sub

labelTime gets value in yyyy-MM-dd H:mm:ss but from some reason, database is not updated. Sub doesn't return any error.

Viewing all articles
Browse latest Browse all 2918

Trending Articles



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