
February 15th, 2001, 11:35 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 23
|
|
|
SQL string used with AutoNumber field in Access
<i><b>Originally posted by : Harry Ragsdale (webmaster@sevendustweb.net)</b></i><br /><br />I am back again. I have my photo album working for the most part. However, I did hit one snag.<br /><br />The script works fine as long as there are no more than 9 pictures in the database. Once 10 pictures are entered, the database lists them like this... : 1,10,11,12,2,3,4,5, etc....<br /><br />What is happening is that when I am going through the pictures on the website, the first picture has the "NEXT" arrow like it is supposed to. When I click on it, it takes me to the second picture, which is what I want. However, once I view the second picture, there is no "Next" arrow. There is only a "Back" arrow. Essentially, when I start with the beginning picture, I can only look at the first two.<br /><br />For an example, got to this URL: http://www.hvrdesigns.com/portfolio/photos/photos.html<br /><br />Once there, click on Days Of The New. Notice that the database only contains 5 photos. If you click on any one of the images, it works perfectly.<br /><br />Now, go back to http://www.hvrdesigns.com/portfolio/photos/photos.html. <br /><br />Now, click on Everlast. Notice that in this database, I have a total of 16 photos. If you click on one of the middle photos, you will see what is happening. <br /><br />When you look at a big photo on my website, they "KEY" that is generated is a number in the database. The number is in the field "ID". I was thinking of setting this field to AutoNumber. However when I tried this, I got a weird error. I know that the code is not wrong because once I perfected the code, I rehashed it for every single band. All I had to change was the name of the database and the rest worked.<br /><br />I tried playing around with the SQL.<br /><br />My initial string which I must keep is this:<br /><br />SELECT * FROM pics where ID=" & quote & Request.QueryString("key") & quote; <br /><br /><br />I was told the following string will allow you to use AutoNumber with ASP:<br /><br />"SELECT Max(id) FROM pics<br /><br />KEEP IN MIND THAT "ID" IS THE FIELD THAT HOLDS ALL THE NUMBER VALUES CORRESPONDING TO THE PICTURES.<br /><br />What is going on here? Please tell me you know what is wrong. I am almost done with this project and am ready to get it off the ground.<br /><br />PLEASE HELP ME!!!
|