Dim NewConn As New OleDbConnection(strConn)      
        NewConn.Open()       
        Dim dlt1 As New OleDbCommand("DELETE * FROM Invoice ", NewConn)
        Dim dlt2 As New OleDbCommand("DELETE * FROM InvoiceDetail", NewConn)       
        Dim dlt3 As New OleDbCommand("DELETE * FROM Receiver ", NewConn)
        Dim dlt4 As New OleDbCommand("DELETE * FROM ReceiverDetail", NewConn)     

        dlt1.ExecuteNonQuery()
        dlt2.ExecuteNonQuery()
        dlt3.ExecuteNonQuery()
        dlt4.ExecuteNonQuery()

How to reset Primary Key table after delete?
Can primary Key reset to start from 1?

tx

Recommended Answers

YOUR PK is auto incremented by the database ?

Jump to Post

All 3 Replies

YOUR PK is auto incremented by the database ?

I get it

Dim cmdReset1 As New OleDbCommand
        cmdReset1.Connection = NewConn
        cmdReset1.CommandText = _
  String.Format( _
      "Alter Table ReceiverDetail Alter Column RecDetKey" _
  & " IDENTITY({0})", 1)
        cmdReset1.ExecuteNonQuery()

tx waqasaslammmeo
plz cek if need modified again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.