I'm using the following code to update a record:
Code:
'// Sub: Update Record
Sub sEditRec
Dim rst, i, strFieldName, strFieldValue
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open "SELECT * FROM tblNewBooks WHERE ID = " & Request.QueryString("edit"), conn, , 3
For i=1 to rst.Fields.Count - 1
Response.Write rst(i).Name
strFieldName = rst(i).Name
strFieldValue = Request.Form(strFieldName)
If strFieldValue = "" Then
rst(strFieldName) = "" '// ERRORS HERE
Else
rst(strFieldName) = strFieldValue
End if
Next
rst.Update
rst.Close
Set rst = Nothing
End Sub
The problem arises when I try and enter a null string into a field. How do I handle this?