That is a terribly inefficient way to handle your database. Seriously bad.
You see... when you add a new row to your table, you are essentially pulling ALL of the data from the table in to ASP, then adding a new row to it. If there are only a couple rows in your table, then it is probably fast, but as your table grows, this process will continue to slow down. Eventually, people will start complaining about performance.
The best way to handle this situation is to issue database commands directly (instead of that nasty field updating business).
Let me give you a nudge in the right direction.
Code:
if request.querystring("type") = "new" then
strSQL = "Insert Into Table(Col1, Col2, Col3) Values('" & Request.Form("Field1") & "','" & Request.Form("Field2") & "','" & Request.Form("Field3") & "')"
objConn.Execute strSQL
else
strSQL = "Update Table Set Col1 = '" & Request.Form("Field1") & "', Col2 = '" & Request.Form("Field2") & "', Col3 = '" & Request.Form("Field3") & "' where FieldID=" & cint(request.querystring("fID"))
objConn.Execute strSQL
end if
This way, you don't need to retrieve anything from the database. There's just one DB call.
I encourage you to get this functionality working using the method I describe above. Then, immediately afterwards, do some research on [google]SQL Injection[/google].
In an ideal world, you should be writing stored procedures in your database. Then, on the ASP side, use command objects to interact with the database. This method is a bit more involved because it requires more code, but it is a lot faster and much more secure. This requires a reasonable effort on your part, but it is well worth it.
-George
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom