View Full Version : database to ASP
ahmedsoliman
07-04-2002, 10:55 AM
id name jop
1 john instructor
2 alex engineer
3 nadia doctor
9 salah doctor
10 goerg engineer
11 ali doctor
if each name has description in my database ,i need if i click on the name get his description from db and insert it in file decription.asp .iwant all the names's descriptions to be shown in the same file description.asp just on click on it
you can do that in several ways. whilst the examples below aren't exactly what you want, the gist remains. :D
selecting a record from db using a hyperlink (http://aspalliance.com/aspxtreme/ado/demos/delete.asp)
selecting a record from db using a dropdownlist (http://aspalliance.com/aspxtreme/ado/demos/dbselect.asp)
just change portions of the code to display only the description field for the selected record instead. :D
oops, forgot the links to the code :D
using a hyperlink (http://aspalliance.com/aspxtreme/shared/viewsrc.aspx?path=/aspxtreme/ado/demos/delete.asp.src)
using a dropdownlist (http://aspalliance.com/aspxtreme/shared/viewsrc.aspx?path=/aspxtreme/ado/demos/dbselect.asp.src)
actually, this example is more along the lines you want, though is done in asp.net.
show me (http://aspalliance.com/aspxtreme/adonet/demos/binddatareadertorepeater.aspx) :D
ahmedsoliman
07-04-2002, 11:14 PM
<a href="delete.asp?recno=<%=recno%>">
i mean this sentece (?recno)
how db know what i cliked, i think (?recno) is the solution but i need more explaination, also i have a similar code ,please care about in your words.
<a href="shopdisplayproducts.asp?id=5&cat=Clothes">
ahmedsoliman
07-04-2002, 11:20 PM
i think i under stand it,thanks you for all,but iwait for your explainations
whammy
07-05-2002, 11:33 PM
With the following code:
<a href="delete.asp?recno=<%=recno%>">
What will happen is when you click on the link, you will be taken to the page:
http://www.whatever.com/delete.asp?recno=123
In a URL, everything after (and including) the "?" is called a "Querystring". The "123" is an example - of course this value would actually be whatever the value of "recno" is when it's compiled on the server-side.
On delete.asp, you would get the value "123" (or whatever other value was passed in the querystring), like this:
<%
recno = Request.QueryString("recno")
%>
Now you have a value for "recno" that you can use to access the database. If you want to make sure the value is being passed, you might write it to the next page, like so:
<% = recno %>
Which is short for <% Response.Write(recno) %>
Regarding the other example you posted, you can pass quite a bit of information in a querystring - (I'm not quite sure what the limit is) - like so:
www.whatever.com/whatever.asp?value1=<% = value1 %>&value2=<% = value2 %>
etc. all you have to do is separate any additional querystring parameters with "&".
P.S. Here's a pretty good link regarding querystrings, also his website has some useful information on ASP:
http://www.haneng.com/Lessons_15.asp
:)
ahmedsoliman
07-06-2002, 01:12 AM
thank you very mush ,you are abest assistance here
whammy
07-08-2002, 04:46 AM
:cool:
Morgoth
07-08-2002, 05:38 AM
Glad I could help! :thumbsup:
:D :p :o
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.