Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: creating a recordset with data from another recordset


Message #1 by 2fourt@h... on Tue, 28 Nov 2000 23:35:45 -0000
Here I create a recordset using MSdatashape.

 

I need to add Products information from rsProducts plus a field containing

the value of "varInstock" which is the sum of avialble products to the

RsNew recordset.





I get the Error



Microsoft Cursor Engine error '80040e21' 



Multiple-step operation generated errors. Check each status value. 





Help Please....



Thank you

Thomas 





strShape = "SHAPE {Select * from tblproducts} " & _

				" Append ({Select Distinct bin_number, *  from tblBins Where Onhand >

1 } " &_

				" Relate upc_code TO upc_code) As rsBins"

	

	rsProducts.Open strShape,strShapeconn,adOpenDynamic		



	set rsNew = server.CreateObject("adodb.recordset")

	

	'Create Empty recordset

	With RsNew

		.CursorLocation = adUseClient

		.Fields.Append "upc_code",adInteger ,12

		.Fields.Append "title",adChar,65

		.Fields.Append "Available",adChar,10

		.Fields.Append "Price1",adChar,10

		.Fields.Append "Price2",adChar,10

		.Fields.Append "Price3",adChar,10

		.Fields.Append "Price4",adChar,10

		.Fields.Append "Price5",adChar,10

	End With

	rsNew.Open ,,adOpenKeyset,adLockOptimistic

	

	

			while Not rsProducts.EOF

			'now the Bins

			gcount = gcount + 1 

			Set rsBins = rsProducts("rsBins").value 

				'Loop throught the bins a count the total in stock

				VarInstock = 0

				While not rsBins.EOF 'and rsBins("Status") = Cint(Ltrim(rTrim(1)))

					VarInstock = varInStock + (rsBins("OnHand") - (rsBins("hold1"))) ' -

rsBins("hold2")))

				rsbins.Movenext

				Wend

					

					With rsNew 

						.AddNew array("upc_code", "Title", "available", "Price1", "Price2",

"Price3", "Price4", "Price5"),_

								array(rsProducts("Upc_code"), rsProducts("Title"),

cInt(varInStock)

,rsProducts("Price1"),rsProducts("Price2"),rsProducts("Price3"),rsProducts("Price4"),rsProducts("Price5"))



					End With

				'rs.Update



			rsProducts.MoveNext

			Wend	


  Return to Index