473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Is it true???Help me please..

7
Is it true???Help me please..
I want to search data from Database..And..The result is view in new "DIV"..


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="new.aspx.vb" Inherits="Testing._new" %>

<%
Dim objDbConn, strConn, rsSearchResults, strSQL, I

If Request.QueryString("action") <> "" Then

'Here you put your code that you use to retrieve your
'search results, something akin to:
objDbConn = Server.CreateObject("ADODB.Connection")
strConn = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../Testing/database/database.mdb")
objDbConn.Open(strConn)

rsSearchResults = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM name_USER WHERE Keyword LIKE '%" & Request.QueryString("keywords") & "%';"
rsSearchResults.Open(strSQL, objDbConn, 1, 1)

'That's your recordset open, now you need to loop through it to display your results
%>
<table>
<% For I = 1 To rsSearchResults.RecordCount %>
<tr><td><%=rsSearchResults("field0")%></td>
<td><%=rsSearchResults("field1")%></td>
<td><%=rsSearchResults("field2")%></td></tr>
<% rsSearchResults.MoveNext
Next %>
</table>
<%
Else
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11_flat.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Search page</title>

<script type="text/javascript">

function GetXmlHttpObject() {
objXMLHttp = null;

if (window.ActiveXObject) {
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
objXMLHttp = new XMLHttpRequest();
}
return objXMLHttp
}

function doAjax(myXmlObj,myUrl,myParameters,myMethod,return Div) {
if (myMethod == "POST") {
myXmlObj.open(myMethod,myUrl,true);
} else {
myXmlObj.open(myMethod,myUrl+"?"+ myParameters,true);
}

myXmlObj.onreadystatechange=function() { stateChanged(myXmlObj,return Div) };
if (myMethod == "POST") {
myXmlObj.send(myParameters);
} else {
myXmlObj.send(null);
}
myXmlObj.close;
}

function stateChanged(thisXML,divToReturn) {
switch (thisXML.readyState) {
case 1:
document.getElementById(divToReturn).innerHTML=thi sXML.responseText;
break;
default:
document.getElementById(divToReturn).innerHTML='<d iv style="top:5px;left:5px;position:relative;filter:a lpha(opacity=60);opacity:0.6;-moz-opacity:0.6;font-weight:bold;">Loading...</div>';
}
}

var xmlHttpObj = GetXmlHttpObject();

</script>

</head>
<body>
<div id="searchfromhere">
<input type="text" name="keywords"/>
<br />
<input type="submit" onclick="javascript:doAjax(xmlHttpObj,'new.aspx',' ?action=search&keywords='+document.forms.elements[0].value,'GET','searchresults');" />
</div>
<div id="searchresults">
</div>
</body>
</html>
<% End If%>
Sep 3 '07 #1
0 774

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Gabriel Mejía | last post by:
Services or applications using ActiveX Data Objects (ADO) 2.0 or greater may intermittently return empty recordsets on queries that should be returning valid results. At the time the problem...
14
by: root | last post by:
Hi group, Apologies in advance if this has been asked somewhere before, but I haven't managed to get anything from the Google archives - I've been getting introductory guides to C++ all day...
6
by: Nick Stansbury | last post by:
Hi, I have a loop running on Page_PreRender that sets a number of controls to invisible based on a set of criteria. Before I do this however, I set all of the drop down lists to be visible with...
0
by: ZackariyaYoosuf | last post by:
Hi guys,anyone can help me... I have to set a form's mdiparent property at run time..But I have the formname as string..how can I do it.. I tried this way .. 'Dim _form As Form =...
3
by: =?Utf-8?B?Sm9obkJhdGVz?= | last post by:
I'm trying to (programatically) backup and clear the security event log on the local machine. I can do this manually through the event viewer and I am logged on as an administrator. I can...
3
by: cj2 | last post by:
In the code below I want when this web service is first published for the boolean Running.running to be True. It seems to default to false. How can I make this default to True? Once the web...
1
by: robin1983 | last post by:
Dear All, I got stuck in simple problem, I have a two php file one for registration form and one for to check and insert into the table. The problem is that when I get any kind error in...
8
by: K Viltersten | last post by:
I can't find any good information on the relation/difference between and attributes in the code. Please advise. -- Regards Konrad Viltersten ---------------------------------------- May...
5
by: WT | last post by:
Hello, IIS6 on W2K3, .net 3.5, Sql 2005. All sp applied. My site is using windows authentication only and the web application connects to sql server residing on another server in the same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.