I
isaac2004
hi how would you go changing a random number generated into a item
drawn from a database with SQL
drawn from a database with SQL
hi how would you go changing a random number generated into a item
drawn from a database with SQL
no having a random item be generated to a page. the items are on the
database and using SQL to generate a random item name using the
Randomize function
my database consists of two tables
And you have no[t] genreated it to(?) a page?I still do not understand what you are asking, Isaak
What is a "generated random item"?
relevand ASP code, you have come up with so far.Tell us about the type and content of your databse, and show us the
randomize
intItemID = Int(22* rnd(1)) +1
for the random but i dont know how to convert the random number into
the item type. this is for my asp class, if you want a working example,
doesnt this code just source from the databse but not put it through a
random number generator
Better show us the code you have so far.
here is the code
[..]
<% Dim intItemID, strSQL, objRS, sngTax, sngDiff
randomize
intItemID = Int(22* rnd(1)) +1
strSQL = "SELECT Items.ItemName, Items.ItemType,
Items.ItemPriceBuy, Vendors.VendorName " & _
"FROM Items, Vendors"
response.write(strSQL)
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open strSQL, objConn
response.write"<center><font color = red>Today's special item is the "
& intItemID & " " & objRS("ItemType") & " " & objRS("VendorName") &
".</font>"
function PriceIt()
If IsNumeric(intItemID) then
sngTax = formatcurrency(objRS("ItemPriceBuy") * 1.8)
sngDiff = formatcurrencty(sngTax - objRs("ItemPriceBuy"))
end if
response.write"<center><font color = red>Today's special item is the "
& objRS("ItemID") & objRS("ItemType") & objRS("VendorName") &
".</font>"
response.write"<center><font color = green>Suggested Retail: " & sngTax
& "</font><br>"
response.write"<center><font color = green>Today only: " &
objRS("ItemPriceBuy") & "</font><br>"
response.write"<center><font color = green>Your Savings: " & sngDiff &
"</font><br>"
end function
%>
<p align='center'><a href='RandomItem.asp'>New Random Item</a></p>
</body>
</html>
a working version of this concept is
http://yorktown.cbe.wwu.edu/sandvig/mis314/assignments/SQL/RandomItem
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.