<% Option Explicit %> <% 'Needed ADO Constants 'Const adCmdTable = &H0002 'Const adLockPessimistic = 2 %> <% 'Read in our form variables Dim strConnectionString, _ strTableName, _ strColumnName, _ strRedirURL strConnectionString = Request("ConnectionString") strTableName = Request("TableName") strRedirURL = Request("RedirURL") 'Create a connection to our database Dim objRS, objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open strConnectionString 'Open the recordset, grabbing the requested table Set objRS = Server.CreateObject("ADODB.Recordset") objRS.MaxRecords = 1 objRS.Open strTableName, objConn, , adLockPessimistic, adCmdTable 'Add a new record objRS.AddNew 'Now, for each form element that begins with "col" 'we need to add it to the table! For Each strColumnName in Request.Form If UCase(Left(strColumnName,3)) = "COL" then 'We need to update the column to the vaule 'entered by the user IF the user entered a 'value If Len(Request(strColumnName)) > 0 Then 'We need to hack of the col part to correspond to 'the correct table column objRS(Mid(strColumnName,4,Len(strColumnName))) = Request(strColumnName) End If End If Next objRS.Update 'needed to solidify our changes! 'Clean up, and redirect the user objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing Response.Redirect strRedirURL %>