SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 4th, 2000, 10:16 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Search in a databse

<i><b>Originally posted by : Dzsollo (dzsollo@primposta.com)</b></i><br />I would like to search one record in a database and then write out the whole record to the screen.<br />For example:<br />Name City Phone<br />Adam London 245 675<br />Jane Paris 125 457<br /><br />I would like to search by name and then write out<br />the City and the Phone too<br /><br />Thanks in advance

Reply With Quote
  #2  
Old December 5th, 2000, 04:47 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
<i><b>Originally posted by : Nordyck (Nordycki@hotmail.com)</b></i><br />This code that I have included is the one I'm currently using form my project. <br /><br />The page is divided into two parts the top part is a table within a form that displays different search criteria. Based on what is selected, the results is displayed at the bottom of the page.<br /><br />This does not match what you are looking for but it has all of the elements that you need.<br /><br />If you look at the code, you will notice that it reference 5 different tables within the database. <br /><br />Note: The program uses a DSN connection. The code commented out is for non-DSN connection. When I tried it, it didn't work so I hadn't played with it to get it to work.<br /><br />This page works fine when using a personal web server at home or on the net.<br /><br />If you have any questions please email me. <br /><br />Thanks<br />Nordyck<br />_____________________<br /><html><br /><br /><head><br /><link rel="stylesheet" href="UGSPAR.css"><br /><title>Select Par No for viewing</title><br /><meta name="GENERATOR" content="Microsoft FrontPage 3.0"><br /></head><br /><%<br />set Conn=Server.CreateObject("ADODB.Connection")<br />MyConnStr = "DSN=MTTestDB"<br />'MyConnStr = "DRIVER={Microsoft Access Driver (*.mdb)};"<br />'MyConnStr = MyConnStr & " DBQ=http://aa/dbase/UGSParDB.mdb;"<br />Conn.Open(MyConnStr)<br />%><br /><br /><body bgcolor="#C0C0C0"><br /><br /><h1>Select Par No for viewing</h1><br /><a href="ParStart.htm">Return to Main Page.</a><br /><br /><form method="POST" action="ParQueryLevel1.asp"><br /> <table border="0" width="100" cellpadding="3"><br /> <tr><br /> <td valign="middle" nowrap align="right">Par No</td><br /> <td valign="middle" nowrap> <input type="text" name="ParNo" size="7"></td><br /> </tr><br /> <tr><br /> <td valign="middle" nowrap align="right">Interm</td><br /> <td valign="middle" nowrap> <select name="Interm" size="1"><br /> <option value></option><br /><% vsql= "SELECT Interm FROM _Interm"<br /> set rs=Server.CreateObject("ADODB.Recordset")<br /> rs.Open vsql, conn, 3, 3<br /> rs.movefirst<br /> While not rs.eof<br /> Response.Write "<option value=" & chr(34) & rs("Interm") & chr(34) & ">" & rs("Interm") & "</Option>" & vbcrlf<br /> rs.movenext<br /> Wend %> </select> <br /> Site <select name="Site" size="1" Value><br /> <option value></option><br /><% vsql= "SELECT * FROM _Site"<br /> set rs=Server.CreateObject("ADODB.Recordset")<br /> rs.Open vsql, conn, 3, 3<br /> rs.movefirst<br /> While not rs.eof<br /> Response.Write "<option value=" & chr(34) & rs("Site") & chr(34) & ">" & rs("Site") & "</Option>" & vbcrlf<br /> rs.movenext<br /> Wend %> </select> Dept <select<br /> name="Dept" size="1" Value><br /> <option value></option><br /><% vsql= "SELECT * FROM _Dept"<br /> set rs=Server.CreateObject("ADODB.Recordset")<br /> rs.Open vsql, conn, 3, 3<br /> rs.movefirst<br /> While not rs.eof<br /> Response.Write "<option value=" & chr(34) & rs("Dept") & chr(34) & ">" & rs("Dept") & "</Option>" & vbcrlf<br /> rs.movenext<br /> Wend %> </select></td><br /> </tr><br /> <tr><br /> <td valign="middle" nowrap align="right">Date Requested</td><br /> <td valign="middle" nowrap> To <input type="text" name="DRTo"<br /> size="10"> From <input type="text"<br /> name="DRFrom" size="10"></td><br /> </tr><br /> <tr><br /> <td valign="middle" nowrap align="right">Date Needed</td><br /> <td valign="middle" nowrap> To <input type="text" name="DNTo"<br /> size="10"> From <input type="text"<br /> name="DNFrom" size="10"></td><br /> </tr><br /> <tr><br /> <td valign="middle" nowrap align="right">Requestor</td><br /> <td valign="middle" nowrap> <input type="text" name="Requestor" size="20"></td><br /> </tr><br /> </table><br /> <p> <br /> <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p><br /></form><br /><%<br />st=""<br />if request.form("ParNo") <> "" then<br /> st = "ParNo=" & request.form("ParNo")<br />else <br /> if (request.form("Requestor")<>"") then<br /> st = "(Requestor='" & request.form("Requestor") & "')"<br /> else<br /> if ((request.form("DRTo")<>"") and (request.form("DRFrom")<>"")) then<br /> if st <> "" then st=st & " AND "<br /> st = "((DateRequested >=#" & request.form("DRTo") & "#) and (DateRequested<=#" & request.form("DRFrom") & "#))"<br /> end if<br /> if ((request.form("DNTo")<>"") and (request.form("DNFrom")<>"")) then<br /> if st <> "" then st=st & " AND "<br /> st = "((DateNeeded >=#" & request.form("DNTo") & "#) and (DateNeeded<=#" & request.form("DNFrom") & "#))"<br /> end if<br /> if (request.form("Interm") <> "") then<br /> if st <> "" then st=st & " AND "<br /> st = st & "(Interm='" & request.form("Interm") & "')"<br /> end if<br /> if (request.form("Site") <> "") then<br /> if st <> "" then st=st & " AND "<br /> st = st & "(Site='" & request.form("Site") & "')"<br /> end if<br /> if (request.form("Dept") <> "") then<br /> if st <> "" then st=st & " AND "<br /> st = st & "(Dept='" & request.form("Dept") & "')"<br /> end if<br /> end if<br />end if<br /><br /><br /> if st <> "" then<br /> st = " WHERE " & st<br /> end if<br /><br />vsql= "SELECT * FROM [PARRequest]" & st<br />set rs=Server.CreateObject("ADODB.Recordset")<br />rs.Open vsql, conn, 3, 3<br />%><br /><br /><hr /><br /><br /><p>Click on the ParNo to view the Par Record. </p><br /><br /><table Border="1"><br /><thead><br /> <tr><br /> <th>Par ID</th><br /> <th>Interm</th><br /> <th>Site</th><br /> <th>Dept</th><br /> <th>Date <br>Requested </th><br /> <th>Date <br>Needed </th><br /> <th>Subject</th><br /> </tr><br /></thead><br /><tbody><br /><%<br /> On Error Resume Next<br /> rs.MoveFirst<br /> While Not rs.eof<br /> %><br /> <tr VALIGN="TOP"><br /> <td><a href="ParViewForm.asp?ParNo=<%= rs("ParNo")%>"><%= rs("ParNo")%> </a><br /> </td><br /> <td><%= rs("Interm")%><br /><br /><br /> </td><br /> <td><%= rs("Site")%><br /><br /><br /> </td><br /> <td><%= rs("Dept")%><br /><br /><br /> </td><br /> <td><%= rs("DateRequested")%><br /><br /><br /> </td><br /> <td><%= rs("DateNeeded")%><br /><br /><br /> </td><br /> <td><%= rs("Subject")%><br /><br /><br /> </td><br /> </tr><br /><%<br /> rs.MoveNext<br /> Wend<br />%><br /></table><br /></body><br /><% rs.close<br /> set rs=nothing<br />%><br /></html><br /><br /><br /><br />------------<br />Dzsollo at 12/4/2000 8:16:27 AM<br /><br />I would like to search one record in a database and then write out the whole record to the screen.<br />For example:<br />Name City Phone<br />Adam London 245 675<br />Jane Paris 125 457<br /><br />I would like to search by name and then write out<br />the City and the Phone too<br /><br />Thanks in advance

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Search in a databse


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek