Answers
Jan 08, 2009 - 11:28 AM
")Else%> <%Response.Write("The following Tickets are opened today")%>
<%Response.Write("Problem ID")%> | <%Response.Write("Team Member Name")%> | <%Response.Write("Subject")%> | <%Response.Write("Component")%> | <%Response.Write("Status of the Problem")%> | Edit |
---|---|---|---|---|---|
<%Response.write(" " & result("ProblemStatusId") & " ")%> | <%Response.write(" " & result("TeamMemberName") & " ")%> | <%Response.write(" " & result("ProblemTitle") & " ")%> | <%Response.write(" " & result("DepartmentName") & " ")%> | <%Response.write(" " & result("ProblemStatus") & " ")%> | <% Dim ProblemStatusID ProblemStatusID=Request.QueryString("ProblemStatusId") %>">Edit |
DetailsforProblem | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jan 08, 2009 - 02:52 PM <%@ LANGUAGE="VBScript" %><% Option Explicit 'Buffer the response, so Response.Expires can be used Response.Buffer = TRUE%> !
Jan 12, 2009 - 02:51 PM Search.asp<%' Declare our variables... always good practice!Dim strURL ' The URL of this page so the form will work ' no matter what this file is named.Dim cnnSearch ' ADO connectionDim rstSearch ' ADO recordsetDim strDBPath ' path to our Access database (*.mdb) fileDim strSQL ' The SQL Query we build on the flyDim strSearch ' The text being looked for' Retreive the URL of this page from Server VariablesstrURL = Request.ServerVariables("URL")' Retreive the term being searched for. I'm doing it on' the QS since that allows people to bookmark results.' You could just as easily have used the form collection.strSearch = Request.QueryString("search")'strSearch = Replace(strSearch, "'", "''")' Since I'm doing this all in one page I need to see if anyone' has searched for something. If they have we hit the DB.' O/W I just show the search form and quit.%>
Search for any details regarding SOST contact form. (% returns all) " method="get"> " />[Try 'am' or 'er' for an example] <%If strSearch <> "" Then' MapPath of virtual database file path to a physical path.' If you want you could hard code a physical path here.strDBPath = Server.MapPath("database.mdb")' Create an ADO Connection to connect to the sample database.' We're using OLE DB but you could just as easily use ODBC or a DSN.set cnnSearch = Server.CreateObject("ADODB.Connection")' This line is for the Access sample database:cnnSearch.Open("Provider=SQLOLEDB.1;Password=helpdesk;Persist Security Info=True;User ID=HelpDesk;Initial Catalog=HelpDesk;Data Source=s9DCA3E") ' Build our query based on the input.strSQL = "SELECT a.ProblemStatusId, a.ProblemStatus, e.DepartmentName, c.ProblemTitle, c.ProblemDescription " _& "FROM (((ProblemsUsersDeptsReps d Inner Join Departments e on d.DepartmentId = e.DepartmentId) Inner Join Problems c on d.ProblemID = c.ProblemID) Inner Join ProblemStatus a on d.ProblemsUsersDeptsRepsId = a.ProblemsUsersDeptsRepsId) " _& "WHERE a.ProblemStatus = 'CLOSED' " _& "OR a.ProblemStatusId LIKE '%" & Replace(strSearch, "'", "''") & "%' " _& "OR e.DepartmentName LIKE '%" & Replace(strSearch, "'", "''") & "%' " _& "OR c.ProblemTitle LIKE '%" & Replace(strSearch, "'", "''") & "%' " _& "OR c.ProblemDescription LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR a.ProblemStatus LIKE '%" & Replace(strSearch, "'", "''") & "%' " _& "ORDER BY a.ProblemStatusId;"' Execute our query using the connection object. It automatically' creates and returns a recordset which we store in our variable.Set rstSearch = cnnSearch.Execute(strSQL)' Display a table of the data in the recordset. We loop through the' recordset displaying the fields from the table and using MoveNext' to increment to the next record. We stop when we reach EOF.' For fun I'm combining some fields and showwing you can do more then' just spit out the data in the form it is in in the table.%>
Answer this question Share Your Own Experience & ExpertiseWe look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions? About QuomonQuomon is a network of IT professionals from around the world, collaborating by sharing knowledgeable answers in their specific field of expertise. Please wait... |
Add New Comment