使用以下代码,我在特定表上运行更新。查询完成没有任何问题(异常)但结果未在表中更新。这怎么可能呢?
表格结构
更新查询
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
更新前:
我在这里缺少什么。