| | |
|
PowerASP active server pages asp.net microsoft .net framework sdk learn asp what is asp tutorial learn asp.net CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
Write to the database |
From: |
Vratislav Vardzik |
Date: |
3/3/1999 12:20:50 PM |
IP: |
195.39.11.253 |
HI I have this form
<%
Set DBConnection = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")
DBConnection.Open "OBEDY", "writer", ""
RS.ActiveConnection = DBConnection
SQL = "SELECT jmeno FROM SEZNAM"
RS.Open SQL
%>
<form name="form1" action="write.asp" method="POST">
<p><select name="UserName" size="1">
<%
while not RS.EOF
%> <option> <%=RS("Jmeno")%> </option>
<%
RS.MoveNext
wend
%> </select> <%
RS.Close
SQL = "SELECT ProductName, " & "ProductPrice, ProductID" & " FROM tbl_Buffet_Products WHERE (((ProductVisible)=1));"
RS.Open SQL
if not RS.EOF then
counter = 0
%> </p>
<%
while not RS.EOF
%>
<table>
<tr>
<td><input type="checkbox" name="check_<%=RS("ProductID")%>" value="<%=RS("ProductID")%>"> </td>
<%=RS("ProductName")%>
<%=RS("ProductPrice")%>
<td></td>
<td><input type="text" name="text_<%=RS("ProductID")%>" size="5"> </td>
</tr>
<%
RS.MoveNext
counter = counter + 1
wend
%>
</table>
<%
else
%>
<div align="center"><center><p>Nenalezen zadny produkt. <%
end if
RS.Close
DBConnection.Close
Set RS = nothing
Set DBConnection = nothing
%> </p>
</center></div><div align="center"><center><p> </p>
</center></div><div align="center"><center><p><input type="submit" value="Submit"
name="B1"></p>
</center></div>
</form>
and this is page for write to the database
<%
Set DBConnection = Server.CreateObject("ADODB.Connection")
DBConnection.Open "OBEDY", "writer", ""
counter = Request.Form("counter")
for i = 0 to counter
if Request.Form("check_" & RS("ProductID")) = "on" then
SQL = "INSERT INTO tbl_Buffet_Orders (OrderUserName, OrderProductID, OrderProductQuantity, OrderDate) VALUES ('" & Request.Form("UserName") & "', " & Request.Form("check_" & RS("ProductID")) & ", '" & Request.Form("text_" & RS("ProductID")) & "', #'" & date()& "#');"
DBConnection.Execute(SQL)
end if
next
DBConnection.Close
Set DBConnection = nothing
%>
I have very big problem
How writw this form to database ?
very very thanksby your answer
VV. |
|
|

|
|
|
|