Hello. SELECT * FROM Movies Tusen takk Ola! Det fungerte perfekt! Noen ganger tanker man bare mye mer komplisert en man trenger...SQL statement, URGENT!
I want to search through 2 fields in a database that include movies. I want to present the result (orgtitle and notitle) in a resultpage. (notitle = Norwegian title). I've scrambled the connection settings....
Here's the form:
<code>
<form action="searchresult.asp" method="get">
<input type="text" name="search" value="" size="15"><br>
<input type="checkbox" name="searchfield" value="orgtitle">Original tittel<br>
<input type="checkbox" name="searchfield" value="notitle">Norsk tittel<br>
<input type="image" src="gfx/sok.gif">
</form>
</code>
On the searchreult.asp page I wish to present the result if the movie searched for exists in either orgtitle or the notitle field.
My searchscript works when i search in either orgtitle or the notitle field in the moviedatabase, but not in both fields.
I use this code to select the statement:
<code>
...
cnnSearch.Open "Provider=SQLOLEDB.1;" & _
"Network=DBMSSOCN;" & _
"Data Source=XX.XX.XX.XX;" & _
"Initial Catalog=.........;" & _
"User ID=.........;" & _
"Password=******"
searchresult = Request.QueryString("searchfield")
strSQL = "SELECT * FROM movie WHERE " & searchresult & " LIKE '%" & Replace(strSearch, "'", "''") & "%' "
Set rstSearch = Server.CreateObject("ADODB.Recordset")
rstSearch.PageSize = PAGE_SIZE
rstSearch.CacheSize = PAGE_SIZE
rstSearch.Open strSQL, cnnSearch, 1,1
</code>
...
And present the result like this:
<code>
...
<%
Do While Not rstSearch.EOF And rstSearch.AbsolutePage = iPageCurrent
%>
<font face="Tahoma" size="2">
">t.jpg" align="left" border="0"><%= rstSearch.Fields("orgtitle").Value %>
<font color="008000">(<%= rstSearch.Fields("prodyear").Value %>)</font><br>
...
</code>
How can I include both fields in this search-statement?
PLEASE help...Sv: SQL statement, URGENT!
WHERE orgTitle LIKE '%Alien%'
OR noTitle LIKE '%Alien%'Sv:SQL statement, URGENT!