Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two Multiple update array problem

Status
Not open for further replies.

schase

Technical User
Sep 7, 2001
1,756
US
Hi all, I have a table with info I need to update into two tables - I've done this with one table no problem every time. But the two are giving me a headache - I'll get errors such as
+++++
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

/financeeditallb2.asp, line 92
++++++
here is the code - thank you in advance for your time.

<%
set rsResults = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsResults.ActiveConnection = MM_my_STRING
rsResults.Source = &quot;SELECT * FROM tblOne&quot;
rsResults.CursorType = 3
rsResults.CursorLocation = 2
rsResults.LockType = 3
rsResults.Open()
rsResults_numRows = 0
%>
<%
set rsCustomer = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsCustomer.ActiveConnection = MM_my_STRING
rsCustomer.Source = &quot;SELECT * FROM tbltwo&quot;
rsCustomer.CursorType = 3
rsCustomer.CursorLocation = 2
rsCustomer.LockType = 3
rsCustomer.Open()
rsCustomer_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsResults_numRows = rsResults_numRows + Repeat1__numRows
%>

<%
if request(&quot;Submit&quot;) <> &quot;&quot; Then
rsCustomer.MoveFirst
fldCustIDArray=Split(Request(&quot;txtCustID&quot;),&quot;,&quot;)
fldCustNameArray=split(Request(&quot;txtCustName&quot;),&quot;,&quot;)
fldCustAddressarray=split(Request(&quot;txtCustAddress&quot;),&quot;,&quot;)
fldCustCityarray=split(Request(&quot;txtCustCity&quot;),&quot;,&quot;)
fldCuststatearray=split(Request(&quot;txtCustState&quot;),&quot;,&quot;)
fldCustZiparray=split(Request(&quot;txtCustZip&quot;),&quot;,&quot;)
fldCustPhone1array=split(Request(&quot;txtCustPhone1&quot;),&quot;,&quot;)
fldCustPhone2array=split(Request(&quot;txtCustPhone2&quot;),&quot;,&quot;)
fldCustEmailarray=split(Request(&quot;txtCustEmail&quot;),&quot;,&quot;)
for i=0 to ubound(fldCustNamearray)
rsCustomer(&quot;CustID&quot;)=trim(fldCustIDarray(i))
rsCustomer(&quot;fldCustname&quot;)=trim(fldCustNamearray(i))
rsCustomer(&quot;fldCustAddress&quot;)=trim(fldCustAddressarray(i))
rsCustomer(&quot;fldCustCity&quot;)=trim(fldCustCityarray(i))
rsCustomer(&quot;fldCustState&quot;)=trim(fldCustStatearray(i))
rsCustomer(&quot;fldCustZip&quot;)=trim(fldCustZiparray(i))
rsCustomer(&quot;fldCustPhone1&quot;)=trim(fldCustPhone1array(i))
rsCustomer(&quot;fldCustPhone2&quot;)=trim(fldCustPhone2array(i))
rsCustomer(&quot;fldEmail&quot;)=trim(fldCustEmailarray(i))
rsCustomer.update
rsCustomer.Movenext
next

end if
%>
<%
if request(&quot;Submit&quot;) <> &quot;&quot; Then
rsResults.MoveFirst
fldDateSoldarray=split(Request(&quot;txtDateSold&quot;),&quot;,&quot;)
fldtypearray=split(Request(&quot;txttype&quot;),&quot;,&quot;)
fldStockNumberarray=split(Request(&quot;txtStockNumber&quot;),&quot;,&quot;)
fldCommentsarray=split(Request(&quot;txtComments&quot;),&quot;,&quot;)
fldMakeArray=split(Request(&quot;txtMake&quot;),&quot;,&quot;)
fldVINArray=split(Request(&quot;txtVIN&quot;),&quot;,&quot;)
fldModelyearArray=split(Request(&quot;txtModelYear&quot;),&quot;,&quot;)
fldSalePricearray=split(Request(&quot;txtSalePrice&quot;),&quot;,&quot;)
fldModelarray=split(Request(&quot;txtModel&quot;),&quot;,&quot;)
for i=0 to ubound(fldDateSoldarray)
rsResults(&quot;fldDateSold&quot;)=trim(fldDateSoldarray(i))
rsResults(&quot;fldType&quot;)=trim(fldTypearray(i))
rsResults(&quot;fldStockNumber&quot;)=trim(fldStockNumberarray(i))
rsResults(&quot;fldComments&quot;)=trim(fldCommentsarray(i))
rsResults(&quot;fldMake&quot;)=trim(fldMakearray(i))
rsResults(&quot;fldVIN&quot;)=trim(fldVINarray(i))
rsResults(&quot;fldModelYear&quot;)=trim(fldModelYeararray(i))
rsResults(&quot;fldSalePrice&quot;)=trim(fldSalePricearray(i))
rsResults(&quot;fldModel&quot;)=trim(fldModelarray(i))
rsResults.update
rsResults.Movenext
next
response.redirect &quot;anotherpage.asp&quot;
End if
%>
&quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
First you are going to want to split those form values on comma-space rather than just comma.
Next, any fields in your database that are numeric might be having variable type issues, so always a good idea to cDbl and cInt data before trying to update in this manner.
Next, try commenting out one block of update code, then the other, both times trying to run it, see if your only getting an error with one of the blocks (rsCustomer vs rsResults)
Next, you may be running into an error in the way you are trying to update. If your are trying to write more records than are already in the table, or writing records with keys that don't already exist in the table, you will have issues. If your planning on all of these being new data that doesn't already exist, use the AddNew method before you start assigning data to the fields and don't include the MoveNext at the bottom.
Next, If I am way off on my estimation of your problems :), please repost with a more exact description of what you are attempting to accomplish, such as types of data acquired, newness of data, etc.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
hi, sorry for the delay - the notification wasnt notifying

I am not sure what you mean by comma and space, or why the space would be needed.

But at either rate, i've narrowed it to being the rsCustomer one that is not working. Why I do not know - the only item I can see that is different is the recordset I pull from for rsCustomer's information is different.

Pulling from rsCustomer2 which pulls based upon rsResults custID number - Then trying to use rsCustomer to let it all insert. &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Comma And Space: The space isn't needed. When the values are passed in a comma-delimited string they are generally passed as &quot;1, 2, 3, 4&quot; so if you split by only the comma you get an array with array(0)=&quot;1&quot; array(1)=&quot; 2&quot;, etc note the extra space. Just a way to pull out the space it adds in.
The Important Stuff: Try doing an EOF check on rsCustomer before doing your MoveFirst. I didn't quite understand the rest, ... you have more recordsets than those two?

-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
I'm guessing the space is right where the line break is - but either way I guess I just don't get what it is for. - unless you mean the array by itself puts a space in that can give errors.

Three recordsets total

The first rsResults pulls data from the first table, the second recordset - rsCustomer2 is within the table's repeat region - it pulls data from a different table using a rsResults ID.

All this displays a-ok. Then upon hitting submit I've got the first table being updates with the rsResults recordset and array - and the second table is supposed to update with the third recordset - rsCustomer into the second table.
&quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
I hate to say it, but I don't see anything off the top of my head, you may want to try printing out the values again from the loop from 0 to UBound, perhaps one of them has less values than it should or nulls. Other than that, I'm at a loss.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
me too - well thank you for your time Tarwn &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top