How do i refer to an Access database value when as

Results 1 to 2 of 2

Thread: How do i refer to an Access database value when as

  1. #1
    Join Date
    Dec 1969
    Posts
    572

    Default How do i refer to an Access database value when as

    I asked a question not too long ago about populating a paragraph with Access database values.... here was the response i got:<BR><BR>in the page that is displaying the details have the sql at the top say : select * from bands and then take the results into some asp variable so that on down the page in the html section you can use :<BR>&#060;p&#062;this band is called &#060;% aspvariablename%&#062; etc &#060;/p&#062;<BR><BR>Now my question is.... how do i refer to a value within the databse when assigning it to a variable. What is the code to do so?<BR><BR>thanks

  2. #2
    David Torres Guest

    Default RE: How do i refer to an Access database value whe

    &#060;%<BR>&#039For example, assuming you have an open db connection...<BR>strSQL = "select * from bands where id = &#039" & id & "&#039"<BR>rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText<BR>if not rs.EOF then<BR> vName = rs("Name")<BR> vLastCD = rs("LastCD") &#039.... etc.<BR>end if<BR>rs.Close<BR>cn.Close<BR>set rs = Nothing<BR>set cn = Nothing<BR>%&#062;<BR><BR>&#060;p&#062;the band is called &#060;% =vName %&#062;, their last CD was titled &#060;% =vLastCD %&#062;&#060;/p&#062;<BR><BR>Make sure you include the "=" before your variable with is the same as typing "Response.Write".<BR><BR>Good Luck,<BR>dat<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •