How do I ensure I allways get the last record in the database? While just using a simple Select Statement it seems to do it by default but I need to make sure it does everytime.
Code:Dim cnn As New OleDbConnection Dim cmd As New OleDbCommand Dim dr As OleDbDataReader cnn.ConnectionString = _ My.Settings.Coupon_BarcodeConnectionString cmd = cnn.CreateCommand cmd.CommandText = "SELECT MarketingPiece, [Number] " & _ "FROM tblMarketingPiece " Try cnn.Open() dr = cmd.ExecuteReader While dr.Read() lblMPN.Text = CStr(dr("MarketingPiece")) lblCN.Text = CStr(dr("Number")) End While dr.Close() cnn.Close() Catch ex As Exception MsgBox("Error: " & ex.Message) Exit Sub End Try




Reply With Quote