The Following code i am using at the moment is to ADD (only) to a database.
But what i need before it adds it to the database is too check the Barcode column to see if what is typed in the txtbarcode.text textbox matches anything in the barcode column in the DB. if it does a messagebox appears to tell them, if not carry on.Code:Dim connection As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = ..\db1.mdb") Dim command As New OleDbCommand("INSERT INTO Table1 (Barcode, Box, Description, Whos) VALUES (@Barcode, @Box, @Description,@Whos)", connection) command.Parameters.AddWithValue("@Barcode", txtBarcode.Text) command.Parameters.AddWithValue("@Box", txtBox.Text) command.Parameters.AddWithValue("@Description", rttDetail.Text) command.Parameters.AddWithValue("@Whos", txtWho.Text) connection.Open() command.ExecuteNonQuery() connection.Close()
any help is helpful
thanks




Reply With Quote