Thimo
11-13-2002, 02:58 AM
<%
Dim whereClause, rs, sql
Dim i, myarray, temparray, x
Dim ItemName, ItemCode, RQty, Price, StaffName, TotalPrice, TPrice, TPrice2
Dim TimeDate
For Each Item in Request.Form("add")
If whereClause <> "" then
whereClause = whereClause & "OR ItemID=" & item
Else
whereClause = "ItemID=" & item
End If
Next
strSQL = "SELECT * FROM Item WHERE " & whereClause
set rs = objConn.Execute(strSQL)
myarray = Request.Form("RQty")
temparray = Split(myarray,",")
Response.Write "<center><h2>Items you Ordered</h2><center>"
%>
<form>
<table border="1" align="center">
<tr>
<th height="25">Item Code</th>
<th>ItemName</th>
<th>Price</th>
<th>Request Quantity</th>
</tr>
<%TPrice = 0%>
<%Do While Not rs.EOF%>
<%For x = 0 to UBound(temparray)%>
<tr align=center>
<td><%=rs("ItemCode")%></td>
<td align=left><%=rs("ItemName")%></td>
<td>$<%=FormatNumber(rs("Price"))%></td>
<td><%Response.Write(temparray(x) & "<br>")%></td>
</tr>
<%
StaffName = Session("PersonName")
ItemCode = rs("ItemCode")
ItemName = rs("ItemName")
Price = rs("Price")
RQty = temparray(x)
TimeDate = Now
TPrice = (RQty * Price)
TPrice2 = TPrice2 + TPrice
%>
<%sql = " INSERT INTO Staff (ItemName, ItemCode, Quantity, Price, StaffName) VALUES ('" & ItemName & "' , '" & ItemCode & "' , '" & RQty & "' , '" & Price & "' , '" & StaffName & "' )" %>
<%objConn.Execute sql%>
<%
dim sql2
sql2 = "INSERT INTO Staff (TimeStamp) VALUES ('" & TimeDate & "')" %>
<%objConn.Execute sql2%> -------> Error on this line
<%rs.MoveNext%>
<%Next%>
<%loop%>
</table>
<%TotalPrice = TPrice2%>
<%=Order%>
Microsoft JET Database Engine error '80040e14'
Syntax error in INSERT INTO statement.
/asp/FinishCart.asp, line 68
hi, its stated that my insert statement has error, but in my other pages i am able to insert the date but not using insert is Recordset.Update
i am able to display the Date <%=Order%> but not able to insert into the Table named Staff...
please help and regards
Dim whereClause, rs, sql
Dim i, myarray, temparray, x
Dim ItemName, ItemCode, RQty, Price, StaffName, TotalPrice, TPrice, TPrice2
Dim TimeDate
For Each Item in Request.Form("add")
If whereClause <> "" then
whereClause = whereClause & "OR ItemID=" & item
Else
whereClause = "ItemID=" & item
End If
Next
strSQL = "SELECT * FROM Item WHERE " & whereClause
set rs = objConn.Execute(strSQL)
myarray = Request.Form("RQty")
temparray = Split(myarray,",")
Response.Write "<center><h2>Items you Ordered</h2><center>"
%>
<form>
<table border="1" align="center">
<tr>
<th height="25">Item Code</th>
<th>ItemName</th>
<th>Price</th>
<th>Request Quantity</th>
</tr>
<%TPrice = 0%>
<%Do While Not rs.EOF%>
<%For x = 0 to UBound(temparray)%>
<tr align=center>
<td><%=rs("ItemCode")%></td>
<td align=left><%=rs("ItemName")%></td>
<td>$<%=FormatNumber(rs("Price"))%></td>
<td><%Response.Write(temparray(x) & "<br>")%></td>
</tr>
<%
StaffName = Session("PersonName")
ItemCode = rs("ItemCode")
ItemName = rs("ItemName")
Price = rs("Price")
RQty = temparray(x)
TimeDate = Now
TPrice = (RQty * Price)
TPrice2 = TPrice2 + TPrice
%>
<%sql = " INSERT INTO Staff (ItemName, ItemCode, Quantity, Price, StaffName) VALUES ('" & ItemName & "' , '" & ItemCode & "' , '" & RQty & "' , '" & Price & "' , '" & StaffName & "' )" %>
<%objConn.Execute sql%>
<%
dim sql2
sql2 = "INSERT INTO Staff (TimeStamp) VALUES ('" & TimeDate & "')" %>
<%objConn.Execute sql2%> -------> Error on this line
<%rs.MoveNext%>
<%Next%>
<%loop%>
</table>
<%TotalPrice = TPrice2%>
<%=Order%>
Microsoft JET Database Engine error '80040e14'
Syntax error in INSERT INTO statement.
/asp/FinishCart.asp, line 68
hi, its stated that my insert statement has error, but in my other pages i am able to insert the date but not using insert is Recordset.Update
i am able to display the Date <%=Order%> but not able to insert into the Table named Staff...
please help and regards