'if t="" or a="" then
'Response.write("<br><br><h4><font color=#666666>กรุณากรอก Keyword เพื่อค้นหาชื่อเรื่อง</font></h4><br><br>")
'else
pageLen = 10
pageNo = request.QueryString("pageNo")
if pageNo="" then pageNo = 1
Set Conn=Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("data/EResearch.mdb"),"" , ""
if t<>"" and a="" and k="" and m="" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Title) like '%"&t&"%') ;"
elseif t="" and a<>"" and k="" and m="" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Author) like '%"&a&"%') ;" ' and ((Eresearch.Major)="& m &") and ((Eresearch.Kind_id)="& k &");"
elseif t="" and a="" and k<>"" and m="" then
sql ="SELECT Kind.Kind_id, Kind.Kind_n, Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major FROM Kind INNER JOIN Eresearch ON Kind.Kind_id=Eresearch.Kind_id Where ((Eresearch.Kind_id)="&k&");"
elseif t="" and a="" and k="" and m<>"" then
sql ="SELECT Eresearch.*, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id Where ((Eresearch.Major)="& m &") ;"
elseif t<>"" and a<>"" and k="" and m="" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Title) like '%"&t&"%') and ((Eresearch.Author) like '%"&a&"%') ;"
elseif t<>"" and a="" and k<>"" and m="" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Title) like '%"&t&"%') and ((Eresearch.Kind_id)="&k&") ;"
elseif t<>"" and a="" and k="" and m<>"" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Title) like '%"&t&"%') and ((Eresearch.Major)="&m&") ;"
elseif t="" and a<>"" and k<>"" and m="" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Author) like '%"&a&"%') and ((Eresearch.Kind_id)="&k&") ;"
elseif t="" and a<>"" and k="" and m<>"" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Author) like '%"&a&"%') and ((Eresearch.Major)="&m&") ;"
elseif t<>"" and a<>"" and k<>"" and m="" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Title) like '%"&t&"%') and ((Eresearch.Author) like '%"&a&"%') and ((Eresearch.Kind_id)="&k&");"
elseif t<>"" and a<>"" and k="" and m<>"" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Title) like '%"&t&"%') and ((Eresearch.Author) like '%"&a&"%') and ((Eresearch.Major)="&m&");"
elseif t="" and a<>"" and k<>"" and m<>"" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Author) like '%"&a&"%') and ((Eresearch.Major)="&m&")and ((Eresearch.Kind_id)="&k&");"
elseif t<>"" and a="" and k<>"" and m<>"" then
sql ="SELECT Eresearch.Barcord, Eresearch.Figure_c, Eresearch.Title, Eresearch.Title_n, Eresearch.Author, Eresearch.Author_n, Eresearch.y_m, Eresearch.Live, Eresearch.Major, Eresearch.Kind_id, Kind.Kind_id, Kind.Kind_n FROM Eresearch INNER JOIN Kind ON Eresearch.Kind_id=Kind.Kind_id where ((Eresearch.Title) like '%"&t&"%') and ((Eresearch.Major)="&m&")and ((Eresearch.Kind_id)="&k&");"
Set RS =Server.CreateObject("ADODB.Recordset")
RS.open Sql,Conn,1,3
If RS.RecordCount=0 Then
%>
<br><br>
<h4 align="center">
<font color="#666666"><span lang="th">ไม่พบชื่อโครงงาน/งานวิจัย/วิทยานิพนธ์ที่ต้องการค้นหา</span> !
</font></h4>
<p align="center">
</p>
<%Else%>
<div align="center">
<br>
<table border="0" width="511" bordercolor="#99CCFF" cellspacing="1" cellpadding="2">
<%
Nrecord=RS.recordcount
Rs.pageSize = pageLen
totalPage = Rs.PageCount
Rs.absolutePage = pageNo
recNo=1
Do While Not RS.EOF and recNo <= pageLen
%>
<tr>
<td width="70" class="set" align="right" height="28">
<img border="0" src="images/check.gif" width="12" height="13"></td>
<td class="set" height="28" width="430" valign="top"><a class=set4 href="showsub.asp?Kind_id=<%=Rs("Kind_id")%>&Barcord=<%=Rs("Barcord")%>"><%= Rs("Title")%></a>/<%= Rs("Author")%>/<%= Rs("y_m")%>/<%= Rs("Major")%>/<a href="paper.asp?BC=<%=RS("Barcord")%>" target=_blank>เอกสาร</a></td>
</tr>
<%
recNo=recNo+1
RS.MoveNext
Loop
rs.close
conn.close
end if