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:
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:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../../Connections/BILLING.asp" -->
<%
FEQUIPID = Request.form("EQUIPID") ' Convert the info from the form to a string
MakeEQUIPID = Replace(FEQUIPID, ", ", "' OR EQUIPID= '") ' Replace comma-space to single quote - OR EQUIPID= - single quote
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_BILLING_STRING
Recordset1.Source = "SELECT *, EQUIPID FROM dbo.BP_Progressor_Non_P2P_Equip_Id WHERE (EQUIPID = '" & MakeEQUIPID & "')"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<div align="center">
<form id="form1" name="form1">
<p> </p>
<table width="751">
<tr>
<td width="175"><div align="center"></div></td>
<td width="73"><div align="center"></div></td>
<td width="144"> </td>
<td width="167"><div align="center"></div></td>
<td width="168"><div align="center"></div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td><div align="center"><%=(Recordset1.Fields.Item("EQUIPID").Value)%></div></td>
<td><div align="center"><%=(Recordset1.Fields.Item("EQUIPNAME").Value)%></div></td>
<td><div align="center">
<input name="Job_No" type="text" id="Job_No" value="<%= Request.QueryString("Job_No") %>" />
</div></td>
<td><div align="center">
<input name="VAT" type="text" id="VAT" />
</div></td>
<td><div align="center">
<input name="Rate" type="text" id="Rate" />
</div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
<p> </p>
</form>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Comment