001.
<%@LANGUAGE=
"VBSCRIPT"
CODEPAGE=
"874"
%>
002.
<%
003.
Set
adoDoc = Server.CreateObject(
"ADODB.connection"
)
004.
Conn =
"Provider=Microsoft.ACE.OLEDB.12.0; Data Source="
& server.MapPath(
"zDigitalLibrary.accdb"
)
005.
adoDoc.open Conn
006.
%>
007.
008.
<html>
009.
<head>
010.
<title>Result</title>
011.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-874"
>
012.
</head>
013.
014.
<body>
015.
016.
<%
017.
xAct= Request.QueryString(
"x0"
)
018.
xSearch= Request.QueryString(
"Search_Act"
)
019.
xDocType = Request.QueryString(
"x1"
)
020.
xSubType = Request.QueryString(
"x2"
)
021.
xSubsubType = Request.QueryString(
"x3"
)
022.
xProject = Request.QueryString(
"x4"
)
023.
xCreator = Request.QueryString(
"x5"
)
024.
xVendor = Request.QueryString(
"x6"
)
025.
xDocnumber = Request.QueryString(
"x7"
)
026.
xTitle = Request.QueryString(
"x8"
)
027.
028.
029.
xArea = Request.QueryString(
"x9"
)
030.
xUnit = Request.QueryString(
"x10"
)
031.
xTagType = Request.QueryString(
"x11"
)
032.
xTag = Request.QueryString(
"x12"
)
033.
xManuf = Request.QueryString(
"x13"
)
034.
xModel = Request.QueryString(
"x14"
)
035.
036.
xDate1 = Request.QueryString(
"x15"
)
037.
xDate2 = Request.QueryString(
"x16"
)
038.
039.
040.
041.
042.
043.
044.
045.
if xAct <>
""
then
046.
xsql =
"select a.* "
047.
xsql = xsql &
" from s_elib_docmast a "
048.
If
xArea <>
""
Or
xUnit <>
""
Or
xTagType <>
""
Or
xTag <>
""
Or
xManuf <>
""
Or
xModel <>
""
Then
049.
xsql = xsql &
" , s_elib_doclink b "
050.
End
If
051.
xsql = xsql &
" where a.inuse = 'T' "
052.
If
xArea <>
""
Or
xUnit <>
""
Or
xTagType <>
""
Or
xTag <>
""
Or
xManuf <>
""
Or
xModel <>
""
Then
053.
xsql = xsql &
" and b.inuse = 'T' "
054.
xsql = xsql &
" and a.doc_id = b.doc_id "
055.
If
xArea <>
""
Then
xsql = xsql &
" and b.link_type = 'AREA' and b.link_key = '"
& xArea &
"' "
056.
If
xUnit <>
""
Then
xsql = xsql &
" and b.link_type = 'UNIT' and b.link_key = '"
& xUnit &
"' "
057.
If
xTagType <>
""
Then
xsql = xsql &
" and b.link_type = 'TAG_TYPE' and b.link_key = '"
& xTagType &
"' "
058.
If
xTag <>
""
Then
xsql = xsql &
" and b.link_type = 'TAG' and b.link_key = '"
& xTag &
"' "
059.
If
xManuf <>
""
Then
xsql = xsql &
" and b.link_type = 'MANUF' and b.link_key = '"
& xManuf &
"' "
060.
If
xModel <>
""
Then
xsql = xsql &
" and b.link_type = 'MODEL' and b.link_key = '"
& xModel &
"' "
061.
End
If
062.
If
xDocType <>
""
Then
xsql = xsql &
" and a.Doc_Type = '"
& xDocType &
"' "
063.
If
xSubType <>
""
Then
xsql = xsql &
" and a.Sub_Type = '"
& xSubType &
"' "
064.
If
xSubSubType <>
""
Then
xsql = xsql &
" and a.Subsub_Type = '"
& xSubSubType &
"' "
065.
If
xProject <>
""
Then
xsql = xsql &
" and a.Project = '"
& xProject &
"' "
066.
If
xCreator <>
""
Then
xsql = xsql &
" and a.Creator = '"
& xCreator &
"' "
067.
If
xVendor <>
""
Then
xsql = xsql &
" and a.Vendor = '"
& xVendor &
"' "
068.
If
xDocnumber <>
""
Then
xsql = xsql &
" and a.Doc_number = '"
& xDocnumber &
"' "
069.
If
xTitle <>
""
Then
xsql = xsql &
" and a.Title = '"
& xTitle &
"' "
070.
071.
072.
073.
074.
075.
076.
077.
078.
If
xDate1 <>
""
Then
xsql = xsql &
" and Doc_Date >= Datevalue('"
& xDate1 &
"')"
079.
If
xDate2 <>
""
Then
xsql = xsql &
" and Doc_Date <= Datevalue('"
& xDate2 &
"')"
080.
081.
082.
083.
084.
085.
086.
087.
else
088.
xsql =
"select a.* "
089.
xsql = xsql &
" from s_elib_docmast a where doc_type ='-' "
090.
091.
end if
092.
xsql = xsql &
" Order by a.doc_id ASC "
093.
094.
095.
096.
ข้างบนเป็นคำสั่ง sql ที่อยู่ในหน้า result.asp ทั้งหมดค่ะ และหน้า result นี้จะแทรกที่คำสั่ง iframe ของหน้า search.asp
097.
098.
ข้างล่างเป็นโค้ดคำสั่งของหน้า search.asp ค่ะ
099.
100.
<%@LANGUAGE=
"VBSCRIPT"
CODEPAGE=
"874"
%>
101.
102.
103.
<html>
104.
<head>
105.
<title>search</title>
106.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-874"
>
107.
</head>
108.
109.
<body bgcolor=
"#E4E4E4"
>
110.
<%
111.
xAct =Request.Form(
"Act"
)
112.
xDoctype = Request.Form(
"Doc_type"
)
113.
xSubtype = Request.Form(
"Subtype"
)
114.
xSubsubtype = Request.Form(
"Subsubtype"
)
115.
xProject = Request.Form(
"Project"
)
116.
xCreator = Request.Form(
"Creator"
)
117.
xVendor = Request.Form(
"Vendor"
)
118.
xDocnumber = Request.Form(
"Doc_number"
)
119.
xTitle = Request.Form(
"Title"
)
120.
121.
122.
xArea = Request.Form(
"Area"
)
123.
xUnit = Request.Form(
"unit"
)
124.
xTagType = Request.Form(
"Tagtype"
)
125.
xTag = Request.Form(
"Tag"
)
126.
xManuf = Request.Form(
"Manuf"
)
127.
xModel = Request.Form(
"model"
)
128.
129.
xDate1 = Request.Form(
"Date1"
)
130.
xDate2 = Request.Form(
"Date2"
)
131.
132.
133.
Set
adocon = Server.CreateObject(
"ADODB.Connection"
)
134.
strCon =
"Provider=Microsoft.ACE.OLEDB.12.0; Data Source="
& Server.MapPath(
"zDigitalLibrary.accdb"
)
135.
136.
%>
137.
<form action=
"search.asp"
method=
"post"
name=
"search"
target=
"_self"
id=
"search"
>
138.
<table width=
"100%"
border=
"0"
>
139.
<tr>
140.
<td><strong><font size=
"5"
color=
"#0033FF"
>Document Search</font></strong>
141.
<hr align=
"left"
color=
"#333333"
size=
"4"
width=
"50%"
> </td>
142.
</tr>
143.
</table>
144.
<table width=
"100%"
border=
"0"
>
145.
<tr>
146.
<td><strong> <strong><font color=
"#5CB900"
size=
"4"
>Detail</font></strong>
147.
</strong><strong></strong><strong></strong><strong></strong><strong></strong></td>
148.
<td colspan=
"3"
> </td>
149.
<td colspan=
"2"
><strong><font color=
"#5CB900"
size=
"4"
>Link</font></strong><strong></strong></td>
150.
</tr>
151.
<tr>
152.
<td width=
"14%"
><strong><font size=
"2"
>Document Type</font></strong></td>
153.
<td width=
"20%"
> <strong><font color=
"#0000FF"
size=
"4"
>
154.
<select style=
155.
<option><%=xDoctype%></option>
156.
<%
157.
xsql =
"select distinct(doc_type) "
158.
xsql = xsql &
" from s_elib_docmast "
159.
xsql = xsql &
" order by doc_type "
160.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
161.
rx_SQL = xsql
162.
rx.Open rx_SQL, strCon,1,3
163.
If
rx.RecordCount <> 0
Then
164.
rx.MoveFirst
165.
Do
While
Not
rx.EOF
166.
%>
167.
<option><%=rx(
"doc_type"
)%></option>
168.
169.
<%
170.
rx.Movenext
171.
Loop
172.
rx.close
173.
End
if
174.
%>
175.
176.
</select>
177.
</font></strong>><strong><font color=
"#0000FF"
size=
"4"
> </font></strong></td>
178.
<td width=
"17%"
><select style=
179.
<option><%=xSubtype%></option>
180.
<%
181.
xsql =
"select distinct(sub_type) "
182.
xsql = xsql &
" from s_elib_docmast "
183.
xsql = xsql &
" order by sub_type "
184.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
185.
rx_SQL = xsql
186.
rx.Open rx_SQL, strCon,1,3
187.
If
rx.RecordCount <> 0
Then
188.
rx.MoveFirst
189.
Do
While
Not
rx.EOF
190.
%>
191.
<option><%=rx(
"sub_type"
)%></option>
192.
<%
193.
rx.Movenext
194.
Loop
195.
rx.close
196.
End
if
197.
%>
198.
199.
</select> >></td>
200.
<td width=
"15%"
><select style=
201.
<option><%=xSubsub_type%></option>
202.
<%
203.
xsql =
"select distinct(Subsub_type) "
204.
xsql = xsql &
" from s_elib_docmast "
205.
xsql = xsql &
" order by Subsub_type "
206.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
207.
rx_SQL = xsql
208.
rx.Open rx_SQL, strCon,1,3
209.
If
rx.RecordCount <> 0
Then
210.
rx.MoveFirst
211.
Do
While
Not
rx.EOF
212.
%>
213.
<option><%=rx(
"Subsub_type"
)%></option>
214.
<%
215.
rx.Movenext
216.
Loop
217.
rx.close
218.
End
if
219.
%>
220.
221.
</select> <font size=
"2"
> </font><font size=
"2"
> </font><font size=
"2"
> </font><font size=
"2"
> </font></td>
222.
<td><font size=
"2"
> <strong>Area</strong></font></td>
223.
<td width=
"22%"
colspan=
"2"
><font size=
"2"
>
224.
<select style=
225.
<option><%=xArea%></option>
226.
<%
227.
xsql =
"select distinct(link_key) "
228.
xsql = xsql &
" from s_elib_doclink where inuse ='T' and (link_type = 'AREA' or link_type is null) "
229.
xsql = xsql &
" order by link_key "
230.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
231.
rx_SQL = xsql
232.
rx.Open rx_SQL, strCon,1,3
233.
If
rx.RecordCount <> 0
Then
234.
235.
Do
While
Not
rx.EOF
236.
%>
237.
<option><%=rx(
"link_key"
)%></option>
238.
<%
239.
rx.Movenext
240.
Loop
241.
rx.close
242.
End
if
243.
%>
244.
245.
</select>
246.
</font></td>
247.
</tr>
248.
<tr>
249.
<td><strong><font size=
"2"
>Project Number</font></strong></td>
250.
<td colspan=
"3"
><select style=
251.
<option><%=xProject%></option>
252.
<%
253.
xsql =
"select distinct(project) "
254.
xsql = xsql &
" from s_elib_docmast "
255.
xsql = xsql &
" order by project "
256.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
257.
rx_SQL = xsql
258.
rx.Open rx_SQL, strCon,1,3
259.
If
rx.RecordCount <> 0
Then
260.
rx.MoveFirst
261.
Do
While
Not
rx.EOF
262.
%>
263.
<option><%=rx(
"project"
)%></option>
264.
<%
265.
rx.Movenext
266.
Loop
267.
rx.close
268.
End
if
269.
%>
270.
271.
</select> <font size=
"2"
> </font><font size=
"2"
> </font><font size=
"2"
> </font></td>
272.
<td width=
"12%"
><font size=
"2"
> <strong>Unit</strong></font></td>
273.
<td colspan=
"2"
><font size=
"2"
>
274.
<select style=
275.
<option><%=xUnit%></option>
276.
<%
277.
xsql =
"select distinct(link_key) "
278.
xsql = xsql &
" from s_elib_doclink where inuse ='T' and (link_type = 'UNIT' or link_type is null) "
279.
xsql = xsql &
" order by link_key "
280.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
281.
rx_SQL = xsql
282.
rx.Open rx_SQL, strCon,1,1
283.
If
rx.RecordCount <> 0
Then
284.
rx.MoveFirst
285.
Do
While
Not
rx.EOF
286.
%>
287.
<option><%=rx(
"link_key"
)%></option>
288.
<%
289.
rx.Movenext
290.
Loop
291.
rx.close
292.
End
if
293.
%>
294.
295.
</select>
296.
</font></td>
297.
</tr>
298.
<tr>
299.
<td height=
"29"
><strong><font size=
"2"
>Creator</font></strong></td>
300.
<td><select style=
301.
<option><%=xCreator%></option>
302.
<%
303.
xsql =
"select distinct(creator) "
304.
xsql = xsql &
" from s_elib_docmast "
305.
xsql = xsql &
" order by creator "
306.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
307.
rx_SQL = xsql
308.
rx.Open rx_SQL, strCon,1,3
309.
If
rx.RecordCount <> 0
Then
310.
rx.MoveFirst
311.
Do
While
Not
rx.EOF
312.
%>
313.
<option><%=rx(
"creator"
)%></option>
314.
<%
315.
rx.Movenext
316.
Loop
317.
rx.close
318.
End
if
319.
%>
320.
321.
</select> ></td>
322.
<td colspan=
"2"
><select style=
323.
<option><%=xVendor%></option>
324.
<%
325.
xsql =
"select distinct(vendor) "
326.
xsql = xsql &
" from s_elib_docmast "
327.
xsql = xsql &
" order by vendor "
328.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
329.
rx_SQL = xsql
330.
rx.Open rx_SQL, strCon,1,3
331.
If
rx.RecordCount <> 0
Then
332.
rx.MoveFirst
333.
Do
While
Not
rx.EOF
334.
%>
335.
<option><%=rx(
"vendor"
)%></option>
336.
<%
337.
rx.Movenext
338.
Loop
339.
rx.close
340.
End
if
341.
%>
342.
</select> <font size=
"2"
> </font><font size=
"2"
> </font></td>
343.
<td><font size=
"2"
> <strong>Tag type</strong></font></td>
344.
<td colspan=
"2"
><font size=
"2"
>
345.
<select style=
346.
<option><%=xTagtype%></option>
347.
<%
348.
xsql =
"select distinct(link_key) "
349.
xsql = xsql &
" from s_elib_doclink where inuse ='T' and (link_type = 'TAG_TYPE' or link_type is null)"
350.
xsql = xsql &
" order by link_key "
351.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
352.
rx_SQL = xsql
353.
rx.Open rx_SQL, strCon,1,3
354.
If
rx.RecordCount <> 0
Then
355.
356.
Do
While
Not
rx.EOF
357.
%>
358.
<option><%=rx(
"link_key"
)%></option>
359.
<%
360.
rx.Movenext
361.
Loop
362.
rx.close
363.
End
if
364.
%>
365.
</select>
366.
</font></td>
367.
</tr>
368.
<tr>
369.
<td><strong><font size=
"2"
>Document Number</font></strong></td>
370.
<td colspan=
"3"
><select name=doc_number id=select35 style=
371.
<option><%=xDoc_number%></option>
372.
<%
373.
xsql =
"select distinct(doc_number) "
374.
xsql = xsql &
" from s_elib_docmast "
375.
xsql = xsql &
" order by doc_number "
376.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
377.
rx_SQL = xsql
378.
rx.Open rx_SQL, strCon,1,3
379.
If
rx.RecordCount <> 0
Then
380.
rx.MoveFirst
381.
Do
While
Not
rx.EOF
382.
%>
383.
<option><%=rx(
"doc_number"
)%></option>
384.
<%
385.
rx.Movenext
386.
Loop
387.
rx.close
388.
End
if
389.
%>
390.
391.
</select> <font size=
"2"
> </font><font size=
"2"
> </font></td>
392.
<td><font size=
"2"
> <strong>Tag</strong></font></td>
393.
<td colspan=
"2"
><font size=
"2"
>
394.
<select style=
395.
<option><%=xTag%></option>
396.
<%
397.
xsql =
"select distinct(link_key) "
398.
xsql = xsql &
" from s_elib_doclink where inuse ='T' and (link_type = 'TAG' or link_type is null) "
399.
xsql = xsql &
" order by link_key "
400.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
401.
rx_SQL = xsql
402.
rx.Open rx_SQL, strCon,1,3
403.
If
rx.RecordCount <> 0
Then
404.
rx.MoveFirst
405.
Do
While
Not
rx.EOF
406.
%>
407.
<option><%=rx(
"link_key"
)%></option>
408.
<%
409.
rx.Movenext
410.
Loop
411.
rx.close
412.
End
if
413.
%>
414.
</select>
415.
</font></td>
416.
</tr>
417.
<tr>
418.
<td><strong><font size=
"2"
>Title</font></strong></td>
419.
<td colspan=
"3"
><select name=Title id=Title style=
420.
<option><%=xTitle%></option>
421.
<%
422.
xsql =
"select distinct(title) "
423.
xsql = xsql &
" from s_elib_docmast "
424.
xsql = xsql &
" order by title "
425.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
426.
rx_SQL = xsql
427.
rx.Open rx_SQL, strCon,1,3
428.
If
rx.RecordCount <> 0
Then
429.
rx.MoveFirst
430.
Do
While
Not
rx.EOF
431.
%>
432.
<option><%=rx(
"title"
)%></option>
433.
<%
434.
rx.Movenext
435.
Loop
436.
rx.close
437.
End
if
438.
%>
439.
440.
</select> <font size=
"2"
> </font><font size=
"2"
> </font></td>
441.
<td><font size=
"2"
> <strong>Manufacturer</strong></font></td>
442.
<td colspan=
"2"
><font size=
"2"
>
443.
<select style=
444.
<option><%=xManuf%></option>
445.
<%
446.
xsql =
"select distinct(link_key) "
447.
xsql = xsql &
" from s_elib_doclink where inuse ='T' and (link_type = 'MANUF' or link_type is null)"
448.
xsql = xsql &
" order by link_key "
449.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
450.
rx_SQL = xsql
451.
rx.Open rx_SQL, strCon,1,3
452.
If
rx.RecordCount <> 0
Then
453.
454.
Do
While
Not
rx.EOF
455.
%>
456.
<option><%=rx(
"link_key"
)%></option>
457.
<%
458.
rx.Movenext
459.
Loop
460.
rx.close
461.
End
if
462.
%>
463.
</select>
464.
</font></td>
465.
</tr>
466.
<tr>
467.
<td><strong><font size=
"2"
>
Date
: from : to</font></strong></td>
468.
<td colspan=
"3"
> <input name=
"Date1"
type=
"text"
size=
"10"
maxlength=
"10"
>
469.
<input name=
"Date2"
type=
"text"
size=
"10"
maxlength=
"10"
>
470.
<font size=
"2"
> </font><font size=
"2"
>
471.
<input type=
"hidden"
name=
"Act"
value=
"A"
>
472.
</font></td>
473.
<td><font size=
"2"
> <strong>Model</strong></font></td>
474.
<td colspan=
"2"
><font size=
"2"
>
475.
<select style=
476.
<option><%=xModel%></option>
477.
<%
478.
xsql =
"select distinct(link_key) "
479.
xsql = xsql &
" from s_elib_doclink where inuse ='T' and (link_type = 'MODEL' or link_type is null) "
480.
xsql = xsql &
" order by link_key "
481.
Set
rx = Server.CreateObject(
"ADODB.Recordset"
)
482.
rx_SQL = xsql
483.
rx.Open rx_SQL, strCon,1,3
484.
If
rx.RecordCount <> 0
Then
485.
486.
Do
While
Not
rx.EOF
487.
%>
488.
<option><%=rx(
"link_key"
)%></option>
489.
<%
490.
rx.Movenext
491.
Loop
492.
rx.close
493.
End
if
494.
%>
495.
</select>
496.
</font></td>
497.
</tr>
498.
</table>
499.
</hr>
500.
<table width=
"100%"
border=
"0"
>
501.
<tr>
502.
<td height=
"26"
><div align=
"center"
> </div>
503.
<strong></strong></td>
504.
<td width=
"66%"
><font size=
"2"
>
505.
<input name=
"Clear"
type=
"reset"
value=
"Clear"
align=
"right"
style=
506.
<input name=
"search2"
type=
"submit"
value=
"Search"
align=
"right"
style=
507.
<input name=
"exit"
type=
"button"
value=
"Exit"
align=
"right"
style=
508.
<input name=
"Input"
type=
"text"
size=
"5"
maxlength=
"5"
value
"<%=Nrecord%>"
>
509.
</font></td>
510.
511.
</tr>
512.
<tr>
513.
<td colspan=
"2"
><p>
514.
<iframe name=
"Result"
src=
"result.asp?x0=<%=xAct %>&x1=<%=xDoctype %>&x2=<%=xSubtype %>&x3=<%=xSubsubtype %>&x4=<%=xProject %>&x5=<%=xCreator %>&x6=<%=xVendor %>&x7=<%=xDocnumber %>&x8=<%=xTitle %>&x9=<%=xArea%>&x10=<%=xUnit%>&x11=<%=xTagType%>&x12=<%=xTag%>&x13=<%=xManuf%>&x14=<%=xModel%>&x15=<%=xDate1%>&x16=<%=xDate2%>"
scrolling=
"yes"
width=
"950"
height=
"280"
></iframe>
515.
</p></td>
516.
</tr>
517.
</table>
518.
</hr>
519.
</form>
520.
521.
</body>
522.
</html>