473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Insert multiple rows: from table web form into SQL table

2
Hi there,
I'm trying to insert multiple rows from a table format web form into multiple rows in a SQL table, (1 row for 1 row).
Any help would be greatly appreciated, thanks in advance

Here's the code of my page:
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="../../../Connections/BILLING.asp" -->
  3. <%
  4. FEQUIPID = Request.form("EQUIPID") ' Convert the info from the form to a string
  5.  
  6. MakeEQUIPID = Replace(FEQUIPID, ", ", "' OR EQUIPID= '") ' Replace comma-space to single quote - OR EQUIPID= - single quote
  7.  
  8. %>
  9. <%
  10. Dim Recordset1
  11. Dim Recordset1_numRows
  12.  
  13. Set Recordset1 = Server.CreateObject("ADODB.Recordset")
  14. Recordset1.ActiveConnection = MM_BILLING_STRING
  15. Recordset1.Source = "SELECT *, EQUIPID  FROM dbo.BP_Progressor_Non_P2P_Equip_Id  WHERE (EQUIPID = '" & MakeEQUIPID & "')"
  16. Recordset1.CursorType = 0
  17. Recordset1.CursorLocation = 2
  18. Recordset1.LockType = 1
  19. Recordset1.Open()
  20.  
  21. Recordset1_numRows = 0
  22. %>
  23. <%
  24. Dim Repeat1__numRows
  25. Dim Repeat1__index
  26.  
  27. Repeat1__numRows = -1
  28. Repeat1__index = 0
  29. Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
  30. %>
  31. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  32. <html xmlns="http://www.w3.org/1999/xhtml">
  33. <head>
  34. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  35. <title>Untitled Document</title>
  36. </head>
  37.  
  38. <body>
  39. <div align="center">
  40.   <form id="form1" name="form1">
  41.     <p>&nbsp;</p>
  42.     <table width="751">
  43.       <tr>
  44.         <td width="175"><div align="center"></div></td>
  45.         <td width="73"><div align="center"></div></td>
  46.         <td width="144">&nbsp;</td>
  47.         <td width="167"><div align="center"></div></td>
  48.         <td width="168"><div align="center"></div></td>
  49.       </tr>
  50.       <% 
  51. While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
  52. %>
  53.         <tr>
  54.           <td><div align="center"><%=(Recordset1.Fields.Item("EQUIPID").Value)%></div></td>
  55.           <td><div align="center"><%=(Recordset1.Fields.Item("EQUIPNAME").Value)%></div></td>
  56.           <td><div align="center">
  57.             <input name="Job_No" type="text" id="Job_No" value="<%= Request.QueryString("Job_No") %>" />
  58.           </div></td>
  59.           <td><div align="center">
  60.             <input name="VAT" type="text" id="VAT" />
  61.           </div></td>
  62.           <td><div align="center">
  63.             <input name="Rate" type="text" id="Rate" />
  64.           </div></td>
  65.         </tr>
  66.         <% 
  67.   Repeat1__index=Repeat1__index+1
  68.   Repeat1__numRows=Repeat1__numRows-1
  69.   Recordset1.MoveNext()
  70. Wend
  71. %>
  72.  
  73.         </table>
  74.     <p>
  75.       <input type="submit" name="Submit" value="Submit" />
  76.     </p>
  77.     <p>&nbsp;</p>
  78.   </form>
  79. </div>
  80. </body>
  81. </html>
  82. <%
  83. Recordset1.Close()
  84. Set Recordset1 = Nothing
  85. %>
Sep 15 '08 #1
4 5641
DrBunchman
979 Expert 512MB
Hi edtrvl,

What's the problem? Are you getting an error?

Dr B
Sep 15 '08 #2
edtrvl
2
The rows aren't inserting, nothing seems to be happening.
Oct 20 '08 #3
iam_clint
1,208 Expert 1GB
I don't see you using addNew or Update anywhere in the code snippet you pasted...
example
Expand|Select|Wrap|Line Numbers
  1. rs.open strSQL, cn, 1, 1
  2. rs.addnew
  3. rs("cat_name") = "charlie"
  4. rs("cat_friend") = "Bob"
  5. rs.update
  6. rs.close
  7.  
Oct 20 '08 #4
actually what is the problem u r having y r u having this much code for creating a recordset just one line is enough, and how do u wanted to insert whether u need to display the records from the db table in html table or u need to inert some field into u r db table from the field u have in ur page.mention that clearly
Oct 23 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
1
by: Tuhin Kumar | last post by:
Hi, I would like to know how to insert multiple rows into a table, using a single INSERT statement. My requirement is like this I have a table ABC which contains multiple employees entries with...
9
by: Martin | last post by:
Hello, I'm new with triggers and I can not find any good example on how to do the following: I have two tables WO and PM with the following fields: WO.WONUM, VARCHAR(10) WO.PMNUM,...
12
by: shank | last post by:
I'm trying to use online samples for submitting multiple records from ASP into a stored procedure. Failing! Through the below form, a user could be submitting many records at a time. I'm not...
2
by: wombat53 | last post by:
Hi Group Are there any DB2 UDB ESE DPF V8.2 users exploiting "buffered inserts" (BIND parm INSERT BUF) *and* "multi-row INSERTS" (many rows associated with the VALUES clause of the INSERT to...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.