<% Option Explicit 'Our ADO constants we'll need Const adOpenForwardOnly = 0 Const adLockOptimistic = 3 Const adCmdTable = &H0002 'Create our connection object and open a connection to our database Dim objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = "DSN=TestDB" objConn.Open 'Create a recordset object Dim objRS Set objRS = Server.CreateObject("ADODB.Recordset") 'Open a table view for the table name specified by Request("TableName") Dim strTableName strTableName = Request("TableName") objRS.Open strTableName, objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable 'Add a new record... objRS.AddNew 'Iterate through the fields of the table... Dim fld For Each fld in objRS.Fields 'If a value for the column name was passed in, 'set the column name equal to the value passed through the form... if Len(Request(fld.Name)) > 0 then fld.Value = Request(fld.Name) end if Next 'We're done, so update the record objRS.Update 'Clean Up... objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing 'Send the user to some confirmation page Response.Redirect "RecordAdded.htm" %>