Purpose
Clears the current row buffers and prepares for positioned insert at the end of a record set. The record is not actually written to the database until the Update method is run.
Syntax
DBStatement.Insert
Compliance:
Level 2
Example
The following example uses a positioned insert to insert a record into a record set. Once the statement is in insert mode, the row buffers are assigned values and then updated to write the new record to the database:
Sub Main()
Dim cnct As DBConnection
Dim stmt As DBStatement
cnct.OpenConnection("MyDSN") 'Open the data source "MyDSN"
stmt.OpenStatement(cnct, dbKeyset, dbRowver)
stmt.ExecuteSQL("SELECT * FROM My Table")
stmt.Insert 'Insert a new record
stmt.Column("CustName") = "Harold"
stmt.Column("CustAddr") = "99 Main Street"
stmt.Column("CustLastContact") = Today
stmt.Update 'Write new record to database
stmt.CloseStatement
cnct.CloseConnection 'Close the connection
End Sub
|