View Full Version : db search without exiting page
Shecky
01-12-2003, 08:45 PM
i want to set up a web page search form that acts like windows file/folder search. To clarify, i was wondering is it possible to search a database and have, say, a graphic linked to a matching record written on the same page as each record is found.
Even if this is horribly easy, please be specific... i mostly use automated code generator programs, and i'm asp-retarded
AIM me! T3knosquid
Morgoth
01-13-2003, 07:08 PM
I think you need to be more specific for anyone to understand what it is you need.
whammy
01-14-2003, 12:18 AM
Hmm, should be somewhat easy to do with ASP.NET (if you're comfortable with it, and I'm not, yet), but with classic ASP you'd be much better off posting the search to the server, and then returning the results you get. Otherwise you have to do some somewhat complex tricks to make it appear that the page is not refreshing (something I usually avoid, when trying to code with time constraints and deadlines).
:)
Morgoth
01-14-2003, 02:31 AM
Well, either way, I still don't understand what he is trying to do.
Has he tried http://www.aspin.com ?
Shecky
01-14-2003, 04:18 AM
I want to simulate windows xp file search. (open a window and click the search button to for a visual aide. I want the left side of the table to act like the search companion pane, with various search critera fields, then, upon execution of the search, in the right pane i want a thumbnail "icon" graphics to appear, which are hyper-linked to the corrisponding records.
Its important for my needs that i dont use frames, iframes, or external data source scripts.
seperate HUGE newbie question... you mentioned ASP.NET
If my server supports ASP does that mean they also support ASP.NET? If my cheapass host would just support PHP i could stop pulling my hair out :(
Morgoth
01-14-2003, 05:12 AM
I see what you mean, and as for the graphics, I don't think you need to worry about it until you have the acually search script made.
When that is completed you need to determin what graphic should go with what type of record, when you have that done, then you make a basic if statement (maybe a few) and say:
If Search result is green, then add this picture, if it's blue then this one.
But you need to determin it. Understand? But to execute the code, you will need to go to a new page or refresh the page you are on, unless you can show me a search script that doesn't need to do that.
ASP.NET is not part os ASP, you need the framework installed, look at your host and ask them.
If you really want to use PHP, then I suggest you look for new host that supports PHP, or get your host to install php so it can run.
Who is your host at the moment?
Shecky
01-14-2003, 07:14 AM
its called www.onedollarhost.net
sounds pretty cheap, eh? :-P
The unlimited site storage and unlimitied transfer for $1 a month is what drew me in :)
Morgoth
01-14-2003, 01:30 PM
Yeah, sounds like a good deal.
But maybe you need to find a host that supports PHP.
There are some free ones, but restrictions apply, and I don't know of many myself.
Why not ask inside of the php forums for a good host, I am sure you'll find EXACTLY what you need. If not, something close.
What type of site do you run? How many people visit it a day?
BigDaddy
01-14-2003, 03:28 PM
Even ASP .NET requires a trip to the server each time.
Theoretically, you could load all variations of what you're looking for, ie: all the files, into an array when the page loads. You'd really need to use javascript/DHTML to do the updates. Check out www.dynamicdrive.com for some ideas on it. They've got a lot of great menu ideas, and you may be able to use one of their solutions.
If you're talking searching a large database, you're pobably out of luck without hitting a database and re-displaying the page each time.
aCcodeMonkey
01-15-2003, 09:14 AM
If you targeted user are only using IE. (example. A company Intranet) There is the RDC.Control which runs client side and is loaded with IE 4+ browsers.
Below is an Example of how to load and update two selection objects.
Form Web page
<html>
<head>
<title>RDC Example</title
<script FOR=window EVENT=onLoad>
// Display Loading Msg
document.getElementById('divLoading').style.visibility='visible'
document.body.style.cursor='wait'
// Load Data Objects
tdcSubscription.URL = 'DataPage.asp?FRM=0&SQL=0';
tdcSubScriptions.FetchOptions=1
tdcSubScriptions.Refresh();
</SCRIPT>
<SCRIPT FOR=tdcSubScriptions EVENT=ondatasetchanged>
oList=document.getElementById('cmbSubscription')
aOptions=new Array
for (i=0;i<tdcSubScriptions.recordset.recordCount;i++){
aOptions[i]=new Option(tdcSubScriptions.recordset(0).value,tdcSubScriptions.recordset(1).value)
oList.options[i]=new Option(aOptions[i].text,aOptions[i].value)
tdcSubscription.recordset.MoveNext()
}
</script>
<SCRIPT FOR=tdcMemberData EVENT=ondatasetchanged>
' Update Members List control
oList=document.getElementById('cmbSubscription')
aOptions=new Array
for (i=0;i<tdcMemberData.recordset.recordCount;i++){
aOptions[i]=new Option(tdcMemberData.recordset(0).value,tdcMemberData.recordset(1).value)
oList.options[i]=new Option(aOptions[i].text,aOptions[i].value)
tdcSubscription.recordset.MoveNext()
}
</script>
<script language="javascript">
function GetMembersData()
oList=document.getElementById('cmbSubscription')
if(oList.selectedIndex!=0){
tdcMemberData.URL = 'DataPage.asp?FRM=0&SQL=1&SubId='+oList.options[oList.selectedIndex].value;
tdcMemberData.FetchOptions=1
tdcMemberData.Refresh();
}
</script>
</head>
<body>
<!--Remote Data Control -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID=tdcSubScriptions
height=0
width=0
codebase="http://activex.microsoft.com/controls/vb6/MSRdc20.cab#version=6.0.84.18">
</OBJECT>
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID=tdcMemberData
height=0
width=0
codebase="http://activex.microsoft.com/controls/vb6/MSRdc20.cab#version=6.0.84.18">
</OBJECT>
<form id="form1" name=Form1">
<font color="#CC0000"><b>*</b></font>Subscriptions:<br>
<select id="cmbSubscription"
name="cmbSubscription"
datasrc=#tdcMemberData
datafld="MembershipLevel"
onChange="GetMembersData()"
size="5">
</select>
<br>
<font color="#CC0000"><b>*</b></font>Members:<br>
<select id="cmbMembers"
name="cmbMembers"
datasrc=#tdcMemberData
datafld="MembershipLevel"
size="20">
</select>
</form>
</body>
</html>
ASP "Data Page"
<% Option Explicit %>
<%
Dim oConn,oRs,sSQL
Response.Expires=0
Set oRs = server.CreateObject("ADODB.RECORDSET")
Set oConn = server.createobject("ADODB.CONNECTION")
oConn.ConnectionString = Application("DbWriter")
If Request.QueryString("FRM") = 0 Then ' Create RDC Data XML DataStream
Select Case CInt(Request.QueryString("SQL"))
Case 0 ' Subscriptions
sSQL = "SELECT ElemName, ElemValue FROM Elements WHERE (((ElemGroupID)='100')) ORDER BY DisplayOrder"
Case 1
sSQL = "SELECT ID, Fname + ' ' + LName AS FullName FROM Members WHERE SubscriptionId = " & Request.QueryString("SubID") &" ORDER BY Lname, FName"
Case 2
sSQL = ""
Case 3
sSQL = ""
End Select
Set oRs = server.CreateObject("ADODB.RECORDSET")
Set oConn = server.createobject("ADODB.CONNECTION")
oConn.ConnectionString=Application("DbWriter")
oConn.open
Response.ContentType = "text/xml"
Const adPersistXML = 1
oRs.Open sSQL,oConn,2,1
oRS.Save Response, adPersistXML
oRs.Close
Set oRs = Nothing
oConn.Close
Set oConn=Nothing
End IF
%>
When the page loads, the first dropdown will be populated.
the onChange event will force a call to the datapage for the second dataset.
All the end user sees is a stutterof the page while the list is being updated.
Another advantage to this method is that almost allof the HTML controls can be bound to a the remote data control.
Here is how to turn a table into a Datagrid
<table id=MemberData datasrc=#tdcMemberData>
<tbody>
<tr id=trTemplate>
<td><span datafld="FNAME"></span></td>
<td><span datafld="LNAME"></span></td>
<td><span datafld="EMAIL"></span></td>
<td><span datafld="HomePhone"></span></td>
<td><span datafld="WorkPhone"></span></td>
<td><span datafld="WorkExtension"></span></td>
</tr>
</tbody>
</table>
As for searching a directory. Read up on the MSDAIPP.DSO provider in MDAC 2.6 and MDAC 2.7 The provider can access file information via internet publishing services
Use the ADO Recordset, Record and Stream Objects to Open Documents (http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B248255)
Hope this helps :cool:
Shecky
01-15-2003, 12:22 PM
well i'll be sifting through that for about the next week. Odd thing is i think i understand most of it. I assume that it'll work the same if i'm using a mdb instead of sql. I might be in over my head. I just found out my server supports php so i'm gunna be exploring that possibility as well.
I really really appreciate you going to all this trouble! I hope this works for me :D
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.