0
我如何更新數據與自動編號字段從ms.net訪問從VB.NET。我嘗試更新這個代碼。但沒有任何變化。更新查詢與自動編號字段在ms訪問從VB.NET
Private Sub BTNUPDATE_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTNUPDATE.Click
Try
getConnect()
Dim strSQL As String
Dim iCount As Integer
strSQL = " UPDATE DEPARTMENT SET [DEPART][email protected],[DEP_DSCRPTN][email protected]_DSCRPTN WHERE [DEP_ID] = @DEP_ID"
Dim cmd As New OleDb.OleDbCommand(strSQL, Conn)
cmd.Parameters.AddWithValue("@DEP_ID", CInt(DEPID.Text))
cmd.Parameters.AddWithValue("@DEPART", CMBDEPT.Text)
cmd.Parameters.AddWithValue("@DEP_DSCRPTN", TXTDESC.Text)
Conn.Open()
iCount = cmd.ExecuteNonQuery()
Conn.Close()
If iCount > 0 Then
MessageBox.Show("Record Updated Successfully!", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information)
If Windows.Forms.DialogResult.OK Then
BTNCLEAR.PerformClick()
End If
Else
MsgBox("No record was inserted")
End If
Catch ex As Exception
MsgBox("ERROR: " + ex.Message, MsgBoxStyle.Information, "Update")
Finally
BTNCLEAR.PerformClick()
End Try
End Sub
在數據庫DEP_ID
是自動編號。 DEPID
是檢索DEP_ID
的標籤框。其實標籤隱藏在表單中。我嘗試上面的代碼。但數據庫中沒有任何變化。請檢查我的代碼並糾正我。
itz工作我的朋友..感謝您的快速重播... :) – Thanzeem 2013-04-30 10:33:04