MS Access简单的SQL更新查询

时间:2018-04-24 20:15:16

标签: sql vb.net ms-access

使用以下代码,我在特定表上运行更新。查询完成没有任何问题(异常)但结果未在表中更新。这怎么可能呢?

表格结构

enter image description here

更新查询

 Dim cmd As New OleDb.OleDbCommand
        cmd.CommandText = " UPDATE  [leadsonline_stores] SET [db_Path] = @db_Path,[Image_Path] = @Image_Path,[lo_Username] = @lo_Username,[lo_Password] = @lo_Password,[lo_Store] = @lo_Store,[Notes] = @Notes,[lo_Active] = @lo_Active WHERE [ID] = @ID "

        cmd.Connection = dbMain

        With cmd.Parameters
            .AddWithValue("@ID", leadsonline_stores_ID)
            .AddWithValue("@db_Path", txtDatabase.Text)
            .AddWithValue("@Image_Path", txtPath.Text)
            .AddWithValue("@lo_Username", txtUsername.Text)
            .AddWithValue("@lo_Password", txtPassword.Text)
            .AddWithValue("@lo_Store", txtStoreId.Text)
            .AddWithValue("@Notes", txtDescription.Text)
            .AddWithValue("@lo_Active", IIf(IsNothing(chkActive.EditValue), DBNull.Value, chkActive.EditValue))
        End With

        Try

            cmd.ExecuteNonQuery()

        Catch ex As Exception
            MessageBox.Show("Error while changing data", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            dbMain.Close()
            Return False
        End Try

更新前:

enter image description here

调试器信息: enter image description here

我在这里缺少什么。

0 个答案:

没有答案