|
| |
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
Write array into Access using DRW (haha) - 1/7/2002 19:26:40
(Hi Spooky! Still digesting that book...u know how bosses who know nothing about ASP like giving u pressure ) I have set up a 2D array (vbscript) and stored the corresponding values to the array. And now I am stuck! Without using pure ASP I don't know how to extract the "recordsets" and write them to Access. Is there a way I can "cheat" by using DRW's submit form to database to achieve this? Basically only 1 column of the fields change and I know the exact number of records to insert. I am trying to store identical products with sequential barcodes into a database using "batch entry" eg. 920001,920002,920003. The only thing that changes is this barcode field, all the other fields are the same.
|
|
|
|
Spooky
Posts: 26597 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Write array into Access using DRW (haha) - 1/8/2002 2:05:36
Sort of like : FOR i = 0 to TotalCount Input = arrInput(0,i) <DRW> INSERT .... '::Input::' .... </DRW> NEXT §þððk¥ Database / DRW Q & A VP-ASP Shopping cart Spooky Login
|
|
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
RE: Write array into Access using DRW (haha) - 1/9/2002 2:54:39
Spooky, Having read your article on extracting the Autonumber from a newly added record, I thought, heck, if u can hack the fpdbform webbot to do that, why can't I extend it by inserting a for/next loop to insert the same data (save one incremental field) n-times? After stripping the grey code and refeshing to display the brown code, I inserted the for counter (see below) counter is a dimmed variable to determine how many times to loop the insert. fp_rs.AddNew FP_DumpError strErrorUrl, "Cannot add new record set to the database" Dim arFormFields0(15) Dim arFormDBFields0(15) Dim arFormValues0(15) for i = 1 to count arFormFields0(0) = "ramtype" arFormDBFields0(0) = "ramtype" arFormValues0(0) = Request("ramtype") etc.... Then positioned the next where I though it has finshed inserting one recordset and proceeded to loop. arFormValues0(14) = Request("stockoutdate") FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0 fp_rs.Update next FP_DumpError strErrorUrl, "Cannot update the database" fp_rs.Close fp_conn.Close It seems to go through the motions of the update but if count = 9 I still only get 1 row of data inserted into the database.
|
|
|
|
Spooky
Posts: 26597 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Write array into Access using DRW (haha) - 1/9/2002 20:41:21
You mentioned you already had an array? If thats the case, you need to redefine the variables each time you loop : FOR i = 0 to TotalCount Input = arrInput(0,i) Input2 = arrInput(1,i) Input3 = arrInput(2,i) The DRW code WONT loop through the variables for you. Thats where the custom part comes in! :) §þððk¥ Database / DRW Q & A VP-ASP Shopping cart Spooky Login
|
|
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
RE: Write array into Access using DRW (haha) - 1/9/2002 22:38:00
quote: FOR i = 0 to TotalCount Input = arrInput(0,i) Input2 = arrInput(1,i) Input3 = arrInput(2,i)
That where I was headed..this is what my array looks like: <table border="1" width="100%"> <tr> <td width="25%">Attributes>></td> <td width="25%">Barcode</td> <td width="25%">Type</td> <td width="25%">Size</td> <td width="25%">Notes</td> </tr> <tr> <td width="25%">Item1</td> <td width="25%"> </td> <td width="25%"> </td> <td width="25%"> </td> <td width="25%"> </td> </tr> <tr> <td width="25%">Item2</td> <td width="25%"> </td> <td width="25%"> </td> <td width="25%"> </td> <td width="25%"> </td> </tr> <tr> <td width="25%">Item3</td> <td width="25%"> </td> <td width="25%"> </td> <td width="25%"> </td> <td width="25%"> </td> </tr> </table> It's 15 across and x down where x=TotalCount So after hacking what is leftover by fpdbform.inc by removing the grey code, I thought...hey, this looks like what I wanted to do and it's already referenced the form field and corresponding database fields so why not just introduce a loop in there somewhere and use TotalCount as the counter and another counter (barcode) and increment it along with TotalCount to product the *one* value in the array that changes in each row.
|
|
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
RE: Write array into Access using DRW (haha) - 1/9/2002 23:38:51
crap..haha it was supposed to show a table. oh well...um... Attributes>> | Barcode | Type | Size | Notes -------------|---------|------|------|------ item1 | | | | item2 | | | | item3 | | | | etc | | | | Will this do?
|
|
|
|
huangpower
Posts: 11 Joined: 6/7/2004 Status: offline
|
RE: Write array into Access using DRW (haha) - 4/23/2006 16:09:17
Dear Spooky, I am trying to write an array into DRW for a cart function. FOR i = 0 TO UBOUND( localCart, 2 ) InputTag = localCart( CARTPID, i ) InputName = localCart( CARTPNAME, i ) InputPrice = localCart( CARTPPRICE, i ) InputShip = localCart( CARTPSHIPPING, i ) InputQuantity = localCart( CARTPQUANTITY, i ) fp_sQry="INSERT INTO Orders ( OrderID, ItemName, ItemQuantity, ItemPrice, ItemShipping) VALUES ( '::OrderID::', '::ItemName::', '::ItemQuantity::', '::ItemPrice::', '::ItemShipping::')" Next =================================================================== But I am receiving the following error .............* I have more values to be inserted, but I am using the only selected items to test if it is even possible to insert array into drw. Microsoft VBScript compilation error '800a03ea' Syntax error /_fpclass/fpdblib.inc, line 2 Sub FP_SetLocaleForPage
|
|
|
|
huangpower
Posts: 11 Joined: 6/7/2004 Status: offline
|
RE: Write array into Access using DRW (haha) - 4/25/2006 6:03:59
Write array into Access using DRW (haha) - reference link http://www.frontpagewebmaster.com/m-42733/tm.htm Hi, my name is Lee and I have been trying to find a way to insert array into database. I came across a posting of you on the link above. I am wondering if you have any luck solving that issue. I have my database on Spooky diet, and using the method he suggested. FOR i = 0 to TotalCount Input = arrInput(0,i) <DRW> INSERT .... '::Input::' .... </DRW> NEXT But I cannot get it to work correctly. If you had time, can you tell me if you got any solution to this problem.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|