I want to open up 2 record sets. Then, copy everything from one record
set to another (excluding a few fields). Is this possible?
I need to exclude my primary key, and fields starting with "TMP_".
I'm trying this, but it's saying ADODB.Recordset error '800a0c93'
Operation is not allowed in this context.
Public Function saveChanges()
Dim strSQL : strSQL = "SELECT * FROM imf WHERE imf_id = " & Form_id
Dim strSQLTMP : strSQLTMP = "SELECT * FROM imf WHERE TMP_imf_id
= " & Form_id
Dim rs : Set rs = Server.CreateObject("adodb.recordset")
Dim rsTMP : Set rsTMP = Server.CreateObject("adodb.recordset")
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.open strSQL,DBHandle.DBConn
rsTMP.open strSQL,DBHandle.DBConn
Dim i, strF
rs.movefirst
For i = 0 To rs.Fields.Count -1
echo i & "- " & rs.Fields(i).Name & "<br>"
strF = rs.Fields(i).Name
If strF = "imf_id" Then
' do nothing
echo "skipping " & strF & "<br>"
ElseIf Left(strF,3) = "TMP" Then
' do nothing
echo "tmpskipping " & strF & "<br>"
Else
rs.Fields.Item(i) = rsTMP.Fields.Item(i)
End If
Next
rs.close : rsTMP.close
Response.End
End Function