473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

search bar problem?

hey, I have just ventured into the fun world of creating a search bar, so far i have a page which you type in a name of a band or album you like, the next page is meant to connect to the sql database and find matches that are LIKE the text entered. However I get an error instead.

ERROR code
Expand|Select|Wrap|Line Numbers
  1. Microsoft OLE DB Provider for ODBC Drivers error '80004005' 
  2.  
  3. [Oracle][ODBC][Ora]ORA-00933: SQL command not properly ended 
  4.  
  5. page/basic search.asp, line 16 
  6.  
here is the results page

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <%@LANGUAGE="VBSCRIPT"%>
  6.  
  7. <%
  8. Dim strSQL, objConn, objRs 
  9.  
  10. strbasicsearch = Request.QueryString ("basicsearch")
  11.  
  12.  
  13. strsql = "select * from band and album where basicsearch like '"& strbasicsearch & "%'"
  14.  
  15. Set objConn = Server.CreateObject("ADODB.Connection")
  16. objConn.open "dsn=Oracle;uid=username;pwd=password"
  17. Set objRs=objConn.execute(strSQL)
  18. %>
  19.  
  20. <HTML>
  21. <HEAD>
  22. <TITLE> band Results Page</TITLE>
  23. <HEAD>
  24. <BODY>
  25. <TABLE>
  26. <TR>
  27. <TD>band name</TD>
  28. <TD>location </TD>
  29. <TD>genre</TD>
  30. <td>album</td>
  31. </TR>
  32.  
  33. <%
  34. Do While Not (objRs.EOF)
  35. %>
  36. <TR>
  37. <TD><%=objRs("band_name")%></TD>
  38. <TD><%=objRs("location")%></TD>
  39. <TD><%=objRs("genre")%></TD>
  40. <TD><%=objRs("album_name")%></TD>
  41.  
  42. </TR>
  43.  
  44. <%
  45. objRs.MoveNext
  46. Loop
  47. objRs.Close
  48. Set objRs=Nothing
  49. objConn.Close
  50. Set objConn=Nothing
  51. %>
  52. </TABLE>
  53.  
  54. </BODY>
  55. </HTML>
  56.  
  57.  
I have a feeling the strsql string is incorrect but im unsure
Jan 31 '08 #1
3 1185
CroCrew
564 Expert 512MB
Microsoft SQL Server or Oracle?
Jan 31 '08 #2
Microsoft SQL Server or Oracle?
im using oracle mate
Jan 31 '08 #3
CroCrew
564 Expert 512MB
Hello j0rdanf1,

All you need to do is change the Database Provider to point to your Oracle DSN and all should work.

In the example below the relationship between the two tables is the BandID.

Example:

Expand|Select|Wrap|Line Numbers
  1. <%
  2.     LacalBandName = replace(Request.QueryString("BandName"),"'","''")
  3.     Set Conn = Server.CreateObject("ADODB.Connection")
  4.         Conn.Open("dsn=xxxxx;uid=xxxxx;pwd=xxxxx;")
  5.         SQL = "SELECT a.*, b.* FROM band a Join album b ON (a.BandID = b.BandID) where a.BandName LIKE '%" & LacalBandName & "%'"
  6.         Set myRS=Server.CreateObject("ADODB.Recordset")
  7.         myRS.Open SQL, Conn
  8.  
  9.     Response.write(myRS("FirstName").value)
  10.     Do Until (myRS.EOF)
  11.         Response.write(myRS("AlbumName").value)
  12.         myRS.MoveNext
  13.     LOOP
  14. %>
  15.  
  16.  

Hope that helps~
Jan 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Andy Jacobs | last post by:
Hi all I have a search function on a site of mine. At the moment, the content is delivered using this: <?php echo $row_Recordset1; ?> The search function goes through the table and...
4
by: Ken Fine | last post by:
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string, return the highlighted search term along with the...
14
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like...
2
by: Zambo via SQLMonster.com | last post by:
Hi! We have Sql Server 2000 in our server (NT 4). Our database have now about +350.000 rows with information of images. Table have lot of columns including information about image name, keywords,...
19
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e.,...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
1
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was...
3
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3...
3
by: Richard S | last post by:
CODE: ASP.NET with C# DATABASE: ACCES alright, im having a problem, probably a small thing, but i cant figure out, nor find it in any other post, or on the internet realy (probably cuz i wouldnt...
4
by: MrWelfare | last post by:
Hi Everyone, I'm currently trying to follow an example I found in a book a while ago to try to create a spotlight (mac-like) search that filters results as one types. The script that I have works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.