|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
Vacations are good
Glad you got it worked out. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Missing operator question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|