Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 6th, 2005, 06:11 PM
photoshop_god photoshop_god is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 322 photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 21 h 36 m 51 sec
Reputation Power: 6
Missing operator question

Hi All,

I am building an image gallery and have stumbled onto a problem that does not make sense to me. I have a page where the user can reorder the gallery by typing in the approriate number for that image. (ie: 1 for the first image, 2 for the second, and so on.) The entire page is working fine accept for this. I keep getting a vbscript missing operator error when they submit the form for reordering. This is the sql statement that I have.

strsql = "Select tblUploads.Sort,tblUploads.UploadID From tblUploads Where tblUploads.UploadID In (" & TotalRecs & ")"

TotalRecs is a series of UploadID's like 2,5,20,25,22 . I have stripped out the last comma. I am populating the TotalRecs var using request.form.

Any help would be appreciated.

Reply With Quote
  #2  
Old February 7th, 2005, 02:21 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
If you don't post the exact error message and the line of code causing the error, along with some of the code surrounding the error line of code, it will be difficult to help.

Otherwise the best I can offer is to track down that missing operator and make it show up.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old February 7th, 2005, 11:19 AM
photoshop_god photoshop_god is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 322 photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 21 h 36 m 51 sec
Reputation Power: 6
Hi Doug,

The line of code that it referrs to is:

strsql = "Select tblUploads.Sort,tblUploads.UploadID From tblUploads Where tblUploads.UploadID In (" & TotalRecs & ")"

The error message is this:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'UploadID In ()'.

I have done a response.write on the variable TotalRecs and it is displaying the UploadID's. They are just in a string 2,15,30,68,45 .

Here is some of the surrounding code:

TotalRecs = Request.Form("TotalRecs")

' Open Connection to the database
set conn = Server.CreateObject("ADODB.Connection")
conn.Open Db_Conn_Str

strsql = "Select tblUploads.Sort,tblUploads.UploadID From tblUploads Where tblUploads.UploadID In (" & TotalRecs & ")"

set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 2, 3

While NOT rs.EOF
rs("Sort") = Request.Form("Sort_" & rs("UploadID"))
rs.Update
rs.MoveNext
WEnd

rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing


Hope this helps.

Reply With Quote
  #4  
Old February 7th, 2005, 03:55 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
Next do a response.write of strsql befor you use it to open your rs, and look over the sql in your browser. You can copy & paste the sql into Access itself and see if it works within Access.

Reply With Quote
  #5  
Old February 10th, 2005, 04:33 PM
photoshop_god photoshop_god is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 322 photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 21 h 36 m 51 sec
Reputation Power: 6
I found the problem and can't believe I did this. The hidden field TotalRecs was not named TotalRecs. Once I changed the name magically it worked!?!? I need a vacation!

Thanks Doug G

Reply With Quote
  #6  
Old February 10th, 2005, 09:27 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
Vacations are good Glad you got it worked out.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Missing operator question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT