Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 显示主键的递减值_Vb.net_Ms Access - Fatal编程技术网

Vb.net 显示主键的递减值

Vb.net 显示主键的递减值,vb.net,ms-access,Vb.net,Ms Access,当我尝试添加新记录时,vb.net会自动以递减值显示主键,但当我单击“注册”并检查ms access文件时,它会显示主键的正确值 错误是@Jaxedin没有显示来自ms access的正确主键,例如:1,当我尝试添加新条目时,它在vb.net上显示-1。在新对象上,主键将始终为-1。插入数据库后将分配主键。您可以在新条目上隐藏该值。@Jaxedin-owh好的。谢谢 Private Sub TblCustomerBindingNavigatorSaveItem_Click(ByVal sende

当我尝试添加新记录时,vb.net会自动以递减值显示主键,但当我单击“注册”并检查ms access文件时,它会显示主键的正确值


错误是@Jaxedin没有显示来自ms access的正确主键,例如:1,当我尝试添加新条目时,它在vb.net上显示-1。在新对象上,主键将始终为-1。插入数据库后将分配主键。您可以在新条目上隐藏该值。@Jaxedin-owh好的。谢谢
Private Sub TblCustomerBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Me.Validate()
    Me.TblCustomerBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.CustomerDataDataSet)

End Sub

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'CustomerDataDataSet.tblCustomer' table. You can move, or remove it, as needed.
    Me.TblCustomerTableAdapter.Fill(Me.CustomerDataDataSet.tblCustomer)

End Sub

Private Sub btnRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegister.Click
    Try
        TblCustomerBindingSource.EndEdit()
        TblCustomerTableAdapter.Update(CustomerDataDataSet.tblCustomer)
        MessageBox.Show("Registered successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Form5.Show()
        Me.Hide()
        Form5.TblReservationBindingSource.AddNew()
        Form5.Label2.Text = Customer_IDTextBox.Text
        Form5.Label3.Text = FirstNameTextBox.Text & " " & LastNameTextBox.Text
    Catch ex As Exception
        MessageBox.Show("Error")
    End Try
End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    FirstNameTextBox.Text = ""
    LastNameTextBox.Text = ""
    Contact_NoTextBox.Text = ""
    Email_AddressTextBox.Text = ""
End Sub

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
    Form1.Show()
    Me.Hide()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Date_Of_RegistrationTextBox.Text = Format(Now, "MM/dd/yyyy, hh:mm:ss tt")
End Sub