Ask a Question related to ASP, Design and Development.
-
Nuno Caldas #1
Some help plz
Ok , here's the deal , ive got a DB where there is a table called products
wich as the "ID", "description" , "Stock" fields in it , i have another one
in wich i have "ID" , "Counted".
What i need to do is to somehow retreive all the data from table 1 into a
form with a texbox where users will put the quantity they count for each of
the ids , after completion it will be sent to the other table.
My form should look like this :
ID Description Counted
------------------------------------
001 Product 1 _______
002 Product 2 _______
003 Product 3 _______
...... .............. ..............
099 Product 99 _______
------------------------------------
"Submit Inventory"
I need all the products in the same form , how can i do this? If i only
display one product at a time i have no prob , but with multiple values i
dont know how! Plz help me!!!!
Thanks
Nuno Caldas Guest
-
Tom B #2
Re: Some help plz
Alright, good deal.
<form method=post action=SaveCount.asp>
<%
Dim sSQL
Dim RS
Dim CN
Dim sConnectionString
sConnectionString="Something Appropriate as found at
[url]www.connectionstrings.com[/url] "
sSQL="SELECT [ID], [Description] FROM [products] ORDER BY [ID]"
Set CN=CreateObject("ADODB.Connection")
CN.Open sConnectionString
Set RS=CN.Execute(sSQL)
if not RS.EOF then
Response.write "<table
border=1><tr><th>ID</th><th>Description</th><th>Counted</th></tr>" & vbCrlf
Do While not RS.EOF
Response.write "<tr><td>" & _
RS.Fields("ID") & _
"</td><td>" & _
RS.Fields("Description") &_
"</td><td>" & _
"<input name=Product" & RS.Fields("ID") & " >" & _
"</td></tr>" & vbCrLf
RS.MoveNext
Loop
Response.write "</table>"
end if
Set RS=nothing
CN.Close
Set CN=nothing
%>
</form>
SaveCount.asp contains....
<%
Dim sSQL
Dim RS
Dim CN
Dim sConnectionString
Dim iCount
sConnectionString="Something Appropriate as found at
[url]www.connectionstrings.com[/url] "
sSQL="SELECT [ID] FROM [products]"
Set CN=CreateObject("ADODB.Connection")
CN.Open sConnectionString
Set RS=CN.Execute(sSQL)
if not RS.EOF then
Do While not RS.EOF
iCount=Request.Form("Product" & RS.Fields("ID"))
if isNumeric(iCount) and (iCount <> "") then
sSQL="UPDATE [products] set [Counted]=" & iCount & " WHERE
[ID]=" & RS.Fields("ID")
Response.write "<li>" & sSQL & "</li>"
CN.Execute sSQL
else
Response.write "<li><b>Did not update ID: " &
RS.Fields("ID") & "</b></li>"
end if
RS.MoveNext
Loop
Response.write "All done......"
end if
Set RS=nothing
CN.CLose
Set CN=nothing
%>
"Nuno Caldas" <nunocaldas@iol.pt> wrote in message
news:3f980438$0$1914$a729d347@news.telepac.pt...one> Ok , here's the deal , ive got a DB where there is a table called products
> wich as the "ID", "description" , "Stock" fields in it , i have anotherof> in wich i have "ID" , "Counted".
> What i need to do is to somehow retreive all the data from table 1 into a
> form with a texbox where users will put the quantity they count for each> the ids , after completion it will be sent to the other table.
>
> My form should look like this :
>
> ID Description Counted
> ------------------------------------
> 001 Product 1 _______
> 002 Product 2 _______
> 003 Product 3 _______
> ..... .............. ..............
> 099 Product 99 _______
> ------------------------------------
>
> "Submit Inventory"
>
> I need all the products in the same form , how can i do this? If i only
> display one product at a time i have no prob , but with multiple values i
> dont know how! Plz help me!!!!
>
>
>
> Thanks
>
>
>
Tom B Guest



Reply With Quote

