|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi I'm getting this error in my search.asp Microsoft OLE DB Provider for SQL Servererror '80040e14' Line 1: Incorrect syntax near '/'. /include/search.asp, line 184 Am not sure where the error is....am fairly new at asp so please help! Thanks search.asp follows:: <% 'Search Query 'searches function GetSearches(user_id) response.write "<table width='100%'>" sql = "select * from user_search where user_id=" & user_id 'num_row = 10 script = Request.ServerVariables("Script_Name") page = request("page") 'SQL set rs = server.createobject("ADODB.Recordset") rs.PageSize = num_row rs.CursorLocation = adUseClient rs.open sql, conn If Not rs.EOF Then response.write "<table width='100%'>" If page = "" Then page = 1 Else If page < 1 Then page = 1 Else If CInt(page) > rs.PageCount Then page = rs.PageCount Else page = CInt(page) End If End If End If rs.AbsolutePage = page For a = 1 To rs.PageSize if not rs.eof then 'begin loop body search_id = rs("search_id") %> <tr> <td><a href="user_list.asp?search_id=<%=search_id%>"><%=rs("search_name")%></td> <td align=right><a href="search_delete.asp?search_id=<%=search_id%>">Delete</a></td> </tr> <% rs.MoveNext end if Next response.write "</table>" call PageNavigation(script, page, rs.PageCount, num_row, rs.recordcount) else response.write "No Searches" End If rs.Close set rs = nothing end function function GetSearchQuery(search_id) sql = "select * from user_search where search_id=" & search_id set rsQ = conn.execute(sql) if not rsQ.eof then GetSearchQuery = rsQ("search_query") end if rsQ.close set rsQ = nothing end function function SaveSearchQuery(user_id, search_name, search_query) sql = "insert into user_search (user_id, search_name, search_query, creation_time) values (" & user_id & ", '" & search_name & "', '" & search_query & "', '" & now & "')" conn.execute(sql) end function function DeleteSearchQuery(search_id) sql = "delete from user_search where search_id = " & search_id conn.execute(sql) end function 'wish list function GetWishList(user_id) response.write "<table width='100%'>" sql = "select * from user_wish ws, [user] usr where ws.user_id=" & user_id & " and ws.love_id=usr.user_id" 'num_row = 10 script = Request.ServerVariables("Script_Name") page = request("page") 'SQL set rs = server.createobject("ADODB.Recordset") rs.PageSize = num_row rs.CursorLocation = adUseClient rs.open sql, conn If Not rs.EOF Then response.write "<table width='100%'>" If page = "" Then page = 1 Else If page < 1 Then page = 1 Else If CInt(page) > rs.PageCount Then page = rs.PageCount Else page = CInt(page) End If End If End If rs.AbsolutePage = page For a = 1 To rs.PageSize if not rs.eof then 'begin loop body %> <tr> <td><a href="user_profile.asp?user_id=<%=rs("user_id")%>"><%=rs("username")%></a></td> <td align=right><a href="wish_delete.asp?wish_id=<%=rs("wish_id")%>">Delete</a></td> </tr> <% rs.MoveNext end if Next response.write "</table>" call PageNavigation(script, page, rs.PageCount, num_row, rs.recordcount) else response.write "No Wish List" End If rs.Close set rs = nothing end function function AddToList(user_id, love_id, username) if not WishExists(user_id, love_id) then sql = "insert into user_wish (user_id, love_id, username) values (" & user_id & ", " & love_id & ", '" & username & "')" conn.execute(sql) end if end function function WishExists(user_id, love_id) sql = "select user_id from user_wish where user_id=" & user_id & " and love_id=" & love_id set rs = conn.execute(sql) if rs.eof then WishExists = false else WishExists = true end if rs.close set rs = nothing end function function RemoveFromList(wish_id) sql = "delete from user_wish where wish_id=" & wish_id conn.execute(sql) end function sub ListUsers(num_row, sql) ''num_row = 10 script = Request.ServerVariables("Script_Name") page = request("page") 'SQL set rs = server.createobject("ADODB.Recordset") rs.PageSize = num_row rs.CursorLocation = adUseClient rs.open sql, conn If Not rs.EOF Then response.write "<table width=100% cellspacing=0 cellpadding=0>" If page = "" Then page = 1 Else If page < 1 Then page = 1 Else If CInt(page) > rs.PageCount Then page = rs.PageCount Else page = CInt(page) End If End If End If rs.AbsolutePage = page For a = 1 To rs.PageSize if not rs.eof then 'begin loop body user_id = rs("user_id") GetUser(user_id) age = year(date) - birth_year located = city & ", " & state & ", " & country if len(description) > 150 then description = left(description, 150) & " ..." end if if enabled then status = 0 status_action = "Disable" else status = 1 status_action = "Enable" end if %> <tr valign=top height=130> <td class=pic width=100 valign=middle align=center> <!-- pic --> <a href="/member/user_profile.asp?user_id=<%=user_id%>"><% if len(photo) > 0 then %> <img src="/files/<%=user_id%>/photo/<%=photo%>" border=0 width=80> <% else %> <img src="/files/photo_<%=gender%>.gif" border=0 width=80> <% end if %> </a> </td> <td> <table width=100%> <tr class=headerright> <td> <!-- username, last active --> <table width=100%> <tr> <td><a href="/member/user_profile.asp?user_id=<%=user_id%>"><%=username%></a></td> <td align=right><%=last_active%></td> </tr> </table> </td> </tr> <tr valign=top> <td> <!-- desc --> <table width=100%> <tr> <td> <a href="/member/user_profile.asp?user_id=<%=user_id%>"><%=description%></a><br> Age: <%=age%> <br> Location: <%=located%> <br> <%=gender%> seeking <%=gender_look%><br> </td> <% if isAdmin then %> <td align=right><% if pending then response.write "<font color=red>Pending -> </font>" end if %> <a href="setstatus.asp?status=<%=status%>&user_id=<%=user_id%>&set_type=User"><%=status_action%></a> | <a href="user_delete.asp?user_id=<%=user_id%>&back=<%=request.servervariables("script_name")%>">Delete</a> <% if title = "Subscribe Members" then %> | <a href="user_unsub.asp?user_id=<%=user_id%>&back=<%=request.servervariables("script_name")%>">Unsubscribe</a> <% end if %> </td> <% else %> <td align=right><a href="wish_add.asp?user_name=<%=username%>&user_id=<%=user_id%>">Add to List</a></td> <% end if %> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> <% rs.MoveNext end if Next response.write "</table>" call PageNavigation(script, page, rs.PageCount, num_row, rs.recordcount) else response.write "No results" End If rs.Close set rs = nothing end sub function SearchNav() %> <table cellpadding=0 cellspacing=0> <tr valign=top> <!-- my serches --> <% if feature_save_search then url = "search.asp" else url = "javascript:alert('You do not have acccess to this feature. Please go to My Account and upgrade your plan.')" end if %> <td> <table> <tr> <td class=button><a href="<%=url%>" class=buttontext>My Searches</a></td> </tr> </table> </td> <td> </td> <!--quick search --> <% if feature_quick_search then url = "search_quick.asp" else url = "javascript:alert('You do not have acccess to this feature. Please go to My Account and upgrade your plan.')" end if %> <td> <table> <tr> <td class=button><a href="<%=url%>" class=buttontext>Quick Search</a></td> </tr> </table> </td> <td> </td> <!-- detailed search --> <% if feature_detailed_search then url = "search_detail.asp" else url = "javascript:alert('You do not have acccess to this feature. Please go to My Account and upgrade your plan.')" end if %> <td> <table> <tr> <td class=button><a href="<%=url%>" class=buttontext>Detailed Search</a></td> </tr> </table> </td> </tr> </table> <% end function %> |
|
#2
|
|||
|
|||
|
test URL
The error happens when I select US from the country list and then enter the zip code to search. If I select all countries and add the zip code it works.
test url : www.miitmatch.com Quote:
|
|
#3
|
|||
|
|||
|
insert is not the way to go here!
When you use the (insert) and there is cancantination of values you could have a special character causing this error.
use a stored procedure instead. Example Dim oConn, oCmd Set oConn = Server.CreateObject"ADODB.Connection") oConn.Open "Provider=SQLOLEDB;Server={server name goes here};Database={database name goes gere};uid={userid goes here};pwd={password goes here}" Set oCmd = Server.CreateObject("ADODB.Command") Set oCmd.ActiveConnection = oConn oCmd.CommandType = adCmdStoredProc With ocmd .Parameters.Refresh .CommandText = "insert_user_search" .Parameters("@user_id").Value= user_id .Parameters("@search_name").Value= search_name .Parameters("@search_query").Value= search_query .Execute End With 'Stored procedure CREATE PROCEDURE [insert_user_search] (@user_id [char](50)), @search_name [char](50)), @search_query [char](254)) AS INSERT INTO user_search ( [user_id], [search_name], search_query,creation_time) VALUES ( @userid, @search_name, @search_query,getdate()) GO Quote:
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > SQL Server error '80040e14' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|