<%
'=====================================
'========= Create sql query ==========
'=====================================
strYear = Request.QueryString("year")
if request.form("keywordType") = "Author Last Name" then
strKeywordType = "Authors"
else
strKeywordType = request.form("keywordType")
end if
strTitleKey = request.form("titleKey")
strAuthorKey = request.form("authorKey")
strAbstractKey = request.form("abstractKey")
strKeywords = request.form("keywords")
strChkJournal = request.form("chkJournal")
strChkBook = request.form("chkBook")
strStartYear = request.form("startYear")
strEndYear = request.form("endYear")
If Err.number <> 0 then TrapError Err.description End If 'error check
IF strYear <> "" THEN 'if only pub year is passed
If strYear = 2002 Then
sqlExtra=" AND [Pub Date]<=" + cstr(strYear)
elseif strYear = 0 then
sqlExtra=""
else
sqlExtra=" AND [Pub Date]=" + cstr(strYear)
End If
ELSEIF strTitleKey <> "" OR (strAuthors <> "" AND strAuthors <> "Any") OR strAbstractKey <> "" OR strChkJournal <> "" OR strChkBook <> "" OR strStartYear <> "" OR strEndYear <> "" THEN
sqlExtra = ""
'response.Write("sqlExtra 1 = " & sqlExtra & "
")
'======== Keywords ===========
if strTitleKey <> "" then
strTitleKey = trim(strTitleKey)
sqlExtra = sqlExtra & " AND [Title] LIKE '%" & strTitleKey & "%'"
end if
if strAuthorKey <> "" AND strAuthorKey <> "Any" then
strAuthorKey = trim(strAuthorKey)
sqlExtra = sqlExtra & " AND [Authors] LIKE '%" & strAuthorKey & "%'"
end if
if strAbstractKey <> "" then
strAbstractKey = trim(strAbstractKey)
sqlAbstractKey = " AND [Abstract] LIKE '% " & strAbstractKey & " %'"
end if
' response.Write("sqlExtra 2 = " & sqlExtra & "
")
'======== Journal Checkbox =========
if strChkJournal <> "" then
sqlExtra = sqlExtra & " AND ([Ref Type]='JOUR')"
end if
'======== Book Chapter Checkbox =========
if strChkBook <> "" then
if strChkJournal <> "" then
'remove previous ")" and add OR
sqlExtra = left(sqlExtra, len(sqlExtra)-1) & " OR "
else
sqlExtra = sqlExtra & " AND ("
end if
sqlExtra = sqlExtra & "[Ref Type]='CHAP')"
end if
'response.Write("sqlExtra 3 = " & sqlExtra & "
")
'======== DATE Range =========
if strStartYear <> "" and strEndYear <> "" then
sqlExtra = sqlExtra & " AND ([Pub Date] BETWEEN " & strStartYear & " AND " & strEndYear & ")"
end if
'ELSE
'response.Write("Error: Invalid or No query was submitted.")
' Stop all execution after this line.
'Response.End
END IF
' response.Write("sqlExtra 4 = " & sqlExtra & "
")
'=============================
'== Connect to DB ===
'=============================
Dim oConn, oCmd, oRS
Dim sConnectionString, MdbFilePath
MdbFilePath = Server.MapPath("../pub_database/cnnr00.mdb")
sConnectionString="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
Set oConn = Server.CreateObject("ADODB.Connection")
'oConn.Mode = 3 '3 = adModeReadWrite
oConn.Open sConnectionString
Set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = oConn
sql = "SELECT [Ref ID], Title, Authors, Abstract, Periodical, Volume, Issue, [Pub Date], [Start Page], [End Page], [Title, secondary], [User Def 1], [Web/URL] FROM publications WHERE [User Def 1]='Publication'" + sqlExtra + " ORDER BY [Pub Date] DESC, Title ASC"
'response.Write("sql = " & sql)
oCmd.CommandText = sql
'oCmd.CommandType = 1 'adCmdText
oCmd.Prepared = true
Set oRS = oCmd.Execute
If Err.number <> 0 then TrapError Err.description End If 'error check
%>
PUBLICATIONS
Click on
to view abstracts from the National Library of Medicine database.
To request an article select the checkbox for the appropriate article(s) and click "Submit Request".
<% ProcessErrors 'process any errors that occured %>