Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 14th, 2015, 09:11 AM
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Question Help with logic to photo album

Hi,

I have a BD with two tables:

- The first call TYPES register where the album name, it have the following columns: type_id and TYPE_NAME.
- The second call PICTURES register where the photos in the album, it got the following columns: PIC_ID, PIC_TYPE (where type_id use the data to relate), PIC_NAME and PIC_IMAGE.

Well, when I call the code on html it is acting in a different way. Example: If I register the album named "ASP" and enter three photos in this album, by calling the following code behind it 3 album named "ASP" and a picture in each of them. The correct would bring a name called "ASP" and three pictures registered in it.


Code:
<%
Dim rsTypesGallery__MMColParam
rsTypesGallery__MMColParam = "1"
If (Request.QueryString("iUsuario") <> "") Then 
  rsTypesGallery__MMColParam = Request.QueryString("iUsuario")
End If
%>

<%
Dim rsTypesGallery
Dim rsTypesGallery_numRows
Set rsTypesGallery = Server.CreateObject("ADODB.Recordset")
rsTypesGallery.ActiveConnection = MM_conn_STRING
rsTypesGallery.Source = "SELECT TOP 20 * FROM TYPES, PICTURES WHERE TYPE_USER = '" + Replace(rsTypesGallery__MMColParam, "'", "''") + "' AND TYPE_ID = PIC_TYPE ORDER BY TYPE_DATED DESC"
rsTypesGallery.CursorType = 0
rsTypesGallery.CursorLocation = 2
rsTypesGallery.LockType = 1
rsTypesGallery.Open()
rsTypesGallery_numRows = 0
%>
	
<main role="main">
 <section>
  <div class="section-inner " style="background-color: #9899a8; ">
   <div class="container portfolio" data-id="44">
    <div class="portfolio-list">
     <ul class="row clear">
      <%
      Do while not rsTypesGallery.eof
      %>
      <li class="col col-3 mobile-full lightbox">
      <a href="typeimage.asp?iType=<%=(rsTypesGallery.Fields.Item("TYPE_ID").Value)%>">
       <img width="480" height="360" src="../images/<%= rsTypesGallery.Fields.Item("TYPE_IMAGE") %>" />
       <span class="icon retroicon-gallery"></span>
        <h3><%=(rsTypesGallery.Fields.Item("TYPE_NAME").Value)%></h3>
      </a>
      
      <span class="hidden-gallery hidden">
       <a class="mfp-image" href="../images/<%= rsTypesGallery.Fields.Item("PIC_IMAGE") %>"></a>
      </span>
      </li>	
      
      <%
	rsTypesGallery.movenext
	loop
      %>
     </ul>
    </div><!-- portfolio-list -->
   </div>
  </div>
 </section>	
</main>
<%
rsTypesGallery.close
%>
Please help me, I think the mistake that this excerpt:

Code:
rsTypesGallery.Source = "SELECT TOP 20 * FROM TYPES, PICTURES WHERE TYPE_USER = '" + Replace(rsTypesGallery__MMColParam, "'", "''") + "' AND TYPE_ID = PIC_TYPE ORDER BY TYPE_DATED DESC"
Reply With Quote
  #2 (permalink)  
Old July 15th, 2015, 07:28 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I dont understand what your issue is. You have not been clear at all. This said, yes there is a problem in your SQL. It just cant be running like this, surely it give you a run-time error? You must use & and not + to concatenate.

Also, Avoid using reserved words for field names, this is such a bad habit. If you must, surround the word with []. Its a good practice to use a trailing semi colon for all SQL. Change you code to this:

NOte : If 'TYPE_USER' is an integer get rid of the surrounding single quotes. The code below assumes this field is a string

Code:
rsTypesGallery.Source = "SELECT TOP 20 * FROM [TYPES], PICTURES WHERE TYPE_USER = '" & Replace(rsTypesGallery__MMColParam, "'", "''") & "' AND TYPE_ID = PIC_TYPE ORDER BY TYPE_DATED DESC;"
__________________
Wind is your friend
Matt

Last edited by mat41; July 15th, 2015 at 07:31 PM..
Reply With Quote
  #3 (permalink)  
Old July 17th, 2015, 10:07 AM
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

To call in html use like this:

Code:
<%
Dim rsTypesGallery__MMColParam
rsTypesGallery__MMColParam = "1"
If (Request.QueryString("iUsuario") <> "") Then 
  rsTypesGallery__MMColParam = Request.QueryString("iUsuario")
End If
%>

<%
Dim rsTypesGallery
Dim rsTypesGallery_numRows
Set rsTypesGallery = Server.CreateObject("ADODB.Recordset")
rsTypesGallery.ActiveConnection = MM_conn_STRING
rsTypesGallery.Source = "SELECT TOP 20 * FROM TYPES, PICTURES WHERE TYPE_USER = '" + Replace(rsTypesGallery__MMColParam, "'", "''") + "' AND TYPE_ID = PIC_TYPE ORDER BY TYPE_DATED DESC"
rsTypesGallery.CursorType = 0
rsTypesGallery.CursorLocation = 2
rsTypesGallery.LockType = 1
rsTypesGallery.Open()
rsTypesGallery_numRows = 0
%>
	
<main role="main">
 <section>
  <div class="section-inner " style="background-color: #9899a8; ">
   <div class="container portfolio" data-id="44">
    <div class="portfolio-list">
     <ul class="row clear">
      <%
      Do while not rsTypesGallery.eof
      %>
      <li class="col col-3 mobile-full lightbox">
      <a href="typeimage.asp?iType=<%=(rsTypesGallery.Fields.Item("TYPE_ID").Value)%>">
       <img width="480" height="360" src="../images/<%= rsTypesGallery.Fields.Item("TYPE_IMAGE") %>" />
       <span class="icon retroicon-gallery"></span>
        <h3><%=(rsTypesGallery.Fields.Item("TYPE_NAME").Value)%></h3>
      </a>
      
      <span class="hidden-gallery hidden">
       <a class="mfp-image" href="../images/<%= rsTypesGallery.Fields.Item("PIC_IMAGE") %>"></a>
      </span>
      </li>	
      
      <%
	rsTypesGallery.movenext
	loop
      %>
     </ul>
    </div><!-- portfolio-list -->
   </div>
  </div>
 </section>	
</main>
<%
rsTypesGallery.close
%>

The result appears in the photo number 1:

http://www.hudsonalves.com/mercadolivreimg/photo1.jpg

In my Access database table is my album of this (photo2):

http://www.hudsonalves.com/mercadolivreimg/photo1.jpg

In my Access database my photo table is this (photo3)
http://www.hudsonalves.com/mercadolivreimg/photo3.jpg

The right way: by signing 10 photos to an album, to call in html the system show a single album and inside the 10 photos.
Reply With Quote
  #4 (permalink)  
Old July 19th, 2015, 07:15 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

You need to read about how to use a forum. You issue is not clear at all. You have not bothered to take my advice in my post. Good luck with your issue what-ever it is
__________________
Wind is your friend
Matt
Reply With Quote
  #5 (permalink)  
Old July 22nd, 2015, 09:12 AM
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well I think you know very well SQL, but this precisanto be a little less arrogant and more humble, posted because I need help with my code, it does not help either just do not respond. And if you really want to help try to read carefully and do not be arrogant.
Reply With Quote
  #6 (permalink)  
Old July 22nd, 2015, 07:06 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I must say I am very surprised at the words and tone of your post. I once came here to this forum 15 years ago for help, after a number of years I became proficient and started helping others. I have been doing this ever since. This comment of your is the first time I can recall somebody who needs help has barked at me.

I am unsure if you are aware but there are very few senior members still monitoring the Wrox Classic ASP forms any longer. Have a look at the activity/dates etc...

I am very busy, when I come these days I only really type what is necessary (apart from today). If someone has a clear problem and I have a solution I will type it. if I come here and the problem isn't clear I will say this and ask the person to be more clear. This is what I did to you, did you listen, no. Instead of answering the questions and addressing the suggested actions you barked.

Do you know the foundation of how coding forums work? FYI forums are not a place to get code written. They are a place to bring specific issues including examples, errors, the offending line number etc...... This allows you to make the most of peoples time. It shows you have had a go at getting it correct.

There is a post somewhere about how to get the most out of forums. How to create a great post that will get you solutions. I cant find it. Perhaps some other member reading this may know where it is. Maybe they could even offer their opinion...
__________________
Wind is your friend
Matt
Reply With Quote
  #7 (permalink)  
Old July 22nd, 2015, 07:38 PM
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Funny, now you understand what I wrote. See, you were arrogant when responding surcharges and the code I posted and I think even that was offensive to me, just posted my doubt with the intention of getting ideas that could help with the solution. If you are offended by what I said, it should not have been arrogant. You're barking up a huge text for the simple fact that it was incoviniente with his responsta, do so, since it only knows bark instead of helping. Stay with your forum, I will seek the solution elsewhere, preferably where there has the unfortunate reception I have had here for you. Keep their knowledge to you on a golden box.
Reply With Quote
  #8 (permalink)  
Old July 24th, 2015, 11:51 AM
jminatel's Avatar
Wrox Staff
Points: 18,940, Level: 59
Points: 18,940, Level: 59 Points: 18,940, Level: 59 Points: 18,940, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2003
Location: Indianapolis, IN, USA.
Posts: 1,945
Thanks: 73
Thanked 139 Times in 101 Posts
Default

Hudsonalves: One of the great internet resources about how to ask technical questions on the internet is here:
http://www.catb.org/esr/faqs/smart-questions.html
It's not specifically about Wrox or our forums but I couldn't put it any better.

Whether you get your answer here or elsewhere, I hope this will help you understand what others need to be able to help you. Mat has answered a lot of questions in the more than 11 years he's been helping people on our forum. He's a good judge of whether or not a question is asked in a way others can help with.
__________________
Jim Minatel
Associate Publisher, WROX - A Wiley Brand
Did someone here help you? Click on their post!
Reply With Quote
  #9 (permalink)  
Old July 24th, 2015, 02:34 PM
Authorized User
Points: 42, Level: 1
Points: 42, Level: 1 Points: 42, Level: 1 Points: 42, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

jminatel, thanks for the specification. Only replied to Mat I did not like how he talked to me, I'm not asking anyone to solve the code, just entered the forum for help. The Mat simply said I was confused and did not understand what I wanted, I do not think I was confused, but I specified the way I understand it, anyway. I thought I could get help and I'm just justifying that not needed.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
paging in photo album xperre BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 April 2nd, 2007 03:32 PM
Error posting photo to photo album abel714 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 10 February 5th, 2007 03:07 AM
Wrox Photo Album Help rsearing BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 6 September 27th, 2006 02:30 PM
Photo Album Menus Tremmorkeep BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 August 15th, 2006 01:49 PM



All times are GMT -4. The time now is 01:20 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.