The following code demonstrates how to add a new record to a table. The example uses the Flight Reservation Database.
Const adOpenStatic = 3
Const adLockOptimistic = 3
Set oConn = CreateObject( "ADODB.Connection" )
Set oRst = CreateObject( "ADODB.Recordset" )
oConn.Open "QT_Flight32"
oRst.Open "SELECT * FROM Flights" , oConn, adOpenStatic, adLockOptimistic
oRst.AddNew
oRst( "Flight_Number" ).Value = 21000
oRst( "Departure_Initials" ).Value = "TLV"
oRst( "Departure" ).Value = "Tel Aviv"
oRst( "Day_Of_Week" ).Value = "Sunday"
oRst( "Arrival_Initials" ).Value = "BSA"
oRst( "Arrival" ).Value = "Buenos Aires"
oRst( "Departure_Time" ).Value = "11:00 PM"
oRst( "Arrival_Time" ).Value = "11:00 AM"
oRst( "Airlines" ).Value = "EL-AL"
oRst( "Seats_Available" ).Value = 220
oRst( "Ticket_Price" ).Value = 1400
oRst.Update
oRst.Close : oConn.Close
Set oRst = Nothing : Set oConn = Nothing
Posted in ADODB

daniva




Recent Comments