Forums
This topic is locked
Multiple-step operation generated errors.
11 Feb 2004 03:09:38 Touti P posted:
Hi there,I have a problem with trying to insert multiple records into a database. What I'm trying to do is create a form for data entry. All the information (ie. field names, properties, etc.) I need to create the form is contained in a table in the database. The form consists of 7 rows representing each record and about 8 columns. The code below illustrates a nested loop that cycles through each field in the database which are the text fields on the forms and inserts them one row at a time until all 7 records have been inserted. The problem is that it keeps giving me the following message:
Multiple-step operation generated errors. Check each status value.
I've checked the field size property so it's not that. Any help would be much appreciated. My code is shown below.
Thanks!
Dim rsFields
Set rsFields = Server.CreateObject("ADODB.Recordset"
rsFields.ActiveConnection = MM_DataDictionary_STRING
rsFields.Source = "SELECT * FROM tblField WHERE fkTableID=" & Session("FormID" & " AND SrcTable='" & rsDistinct("SrcTable" & "';"
rsFields.CursorType = 1
rsFields.LockType = 2
rsFields.CursorLocation = 3
rsFields.Open()
strSQL_numRows = 0
Dim rsDB, DB_String
DB = something…..
Set rsDB = Server.CreateObject("ADODB.Recordset"
rsDB.ActiveConnection = DB_String
rsDB.Source = "SELECT * FROM tblTest;"
rsDB.CursorType = 1
rsDB.LockType = 2
rsDB.CursorLocation = 3
rsDB.Open()
strSQL_numRows = 0
for i = 1 to 7
rsDB.AddNew
rsFields.movefirst
for j = 1 to num
Dim fieldname
fieldname = rsFields("FieldName"
If rsFields("ControlType" = "text" Then
If rsFields("LinkFields" <> "" Then
Dim field_str
field_str = rsFields("LinkFields" & i
rsDB(fieldname) = Request(field_str)
Else
rsDB(fieldname) = Request(fieldname & i)
End If
End If
If rsFields("ControlType" = "hidden" Then
rsDB(fieldname) = Request(fieldname)
End If
rsFields.movenext
next
rsDB.Update
next
rsDB.Close
set rsDB = Nothing
rsFields.Close
Set rsFields = Nothing
next
Replies
Replied 11 Feb 2004 19:43:52
11 Feb 2004 19:43:52 Touti P replied:
The above code does insert the records but the error message still appears. It has a problem with the line below:
rsDB(fieldname) = Request(fieldname & i)
Thanks!
rsDB(fieldname) = Request(fieldname & i)
Thanks!