The insert statements used in Snitz can be quite long and because of the way insert statements have to be written, the fieldname and datavalue are not together in the code.
That can also make it more difficult to add mods to a forum.
Below are some functions I've written which can make generating INSERT statements simpler.
<%
'inc_SQLinsert.asp
'Purpose to simplify the creation of SQL insert statements.
'Would be neater as a class, but for compatability, written as functions.
'
'To use:
'SetInsertTable strMemberTablePrefix & "MEMBERS"
'AddInsertColumn "M_NAME", "'" & chkString(rsKey("M_NAME"),"SQLString") & "'"
'AddInsertColumn "M_USERNAME", "'" & chkString(rsKey("M_USERNAME"),"SQLString") & "'"
'AddInsertColumn "M_PASSWORD", "'" & chkString(rsKey("M_PASSWORD"),"SQLString") & "'"
'strSQL = ReturnInsertSQL()
Dim strISI_SQLtable
Dim strISI_SQLcolnames
Dim strISI_SQLcolvalues
Sub SetInsertTable(pstrTable)
strISI_SQLtable = pstrTable
strISI_SQLcolnames = ""
strISI_SQLcolvalues = ""
End Sub
Sub AddInsertColumn(pstrColumnName, pstrColumnValue)
strISI_SQLcolnames = strISI_SQLcolnames & ", " & pstrColumnName
strISI_SQLcolvalues = strISI_SQLcolvalues & ", " & pstrColumnValue
End Sub
Function ReturnInsertSQL()
ReturnInsertSQL = "INSERT INTO " & strISI_SQLtable & " (" & mid(strISI_SQLcolnames,3) & ") VALUES (" & mid(strISI_SQLcolvalues,3) & ")"
End Function
%>