473,657 Members | 2,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search and Find a Record from Excel using ASP

1 New Member
I would like to search and find records from Excel using ASP.
Here is what I have so far,
Can anyone help me?
Thanks.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Option Explicit
  3. Dim strConnection, conn, rs, strSQL, freephone
  4.  
  5. strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
  6. Server.MapPath("book1.xls") & ";" & _
  7. "Extended Properties=""Excel 8.0;HDR=Yes;"";"
  8.  
  9. Set conn = Server.CreateObject("ADODB.Connection")
  10. conn.Open strConnection
  11.  
  12. Set rs = Server.CreateObject("ADODB.recordset")
  13.    strSQL="SELECT * FROM [sheet1$] WHERE freephone=freephone"
  14. rs.open strSQL, conn, 3,3
  15.  
  16. freephone=Request.Form("freephone")
  17.  
  18. %>
  19.  
  20. <form action="test.asp" method="post">Telephone Number :
  21.  <input type="text" name="freephone">        
  22.  <input type="submit" value="Submit">
  23. </form>
  24.  
  25. <%
  26. if freephone  <> "" then
  27. %>
  28.    <table width="100%" cellspacing="0" cellpadding="2" border="1">
  29.    <tr>
  30.      <th>number</th>
  31.      <th>localphone</th>
  32.      <th>freephone</th>
  33.    </tr>
  34. <%
  35. do until rs.EOF
  36.    response.write("<tr>")
  37.    response.write("<td>" & rs("localnumber") & "</td>")
  38.    response.write("<td>" & rs("number") & "</td>")
  39.    response.write("<td>" & rs("freephone") & "</td>")
  40.    response.write("</tr>")
  41.    rs.MoveNext
  42. loop
  43. rs.close
  44. conn.Close
  45. set rs=Nothing
  46. set conn=Nothing%>
  47. </table>
  48. <%  end if %>
  49.  
  50. </body>
  51. </html>
Mar 18 '08 #1
1 1534
jhardman
3,406 Recognized Expert Specialist
I think I have a pretty good idea what you are trying to do, your coding looks syntactically correct, but it doesn't look like it quite does what I think you want it to do. Exactly what problem are you having?

Jared
Mar 23 '08 #2

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

Similar topics

2
3525
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned from my search and how many records I have set it to display per page. All great so far, HOWEVER..... When you click the next link to see the next 10 results on the next page, it just dumps the search details and pulls up all the records in the...
9
20309
by: Christopher Koh | last post by:
I will make a form which will search the database (just like google interface) that will look/match for the exact name in the records of a given fieldname. Any suggestions on how to make the code?
8
3210
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled 'search' may be clicked on by the user and the user can then search all records by postcode. I want to do this to prevent duplicate data entry.
2
4597
by: richardkreidl | last post by:
I want to be able to delete and search for elements in a XML file, I'm using the code below for adding elements which works great: Public Sub cmdAddElement_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddElement.Click Dim doc As New XmlDocument doc.Load("c:UMZ.xml") Dim root As XmlNode = doc.DocumentElement
1
4844
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was wondering if anybody has experienced the same issues
1
2716
by: Eric | last post by:
Hi: I have two files. I search pattern ":" from emails text file and save email contents into a database. Another search pattern " field is blank. Please try again.", vbExclamation + vbOKOnly Me.txtEmail.SetFocus Exit Sub End If Me.txtStatusBar.Value = "Parsing..." strEmail = Me.txtEmail.Value
0
2124
by: mwalsh62 | last post by:
Greetings all! My first post here, and my mind is pudding at this point (any flavor you like)! I have been searching for days, and still can't figure out the proper syntax that I require. This is my first foray into databases and forms, and I've managed to put together one that works pretty well, except I can't figure out a date range search, which is vital to the overall project. What I have is; A database, in Excel, with five fields...
2
2273
by: buddyr | last post by:
Hello, I have a cmd button on form to search for serial number. I notice when I search for record-that if I don't start at the beginning of records I might not find the record. example: if I am searching for 20th record then I search for 10th record I will have to go to to beginning to search for 10th record. Any way to not have to go to the start each time? I have tried using code with find first in it- but it seems like find first is not...
3
4139
by: l2urhwhc4u | last post by:
Hello, I really need help with this problem I'm facing. I'm writing a recipe guide program using VBA form. I got to the part where the user can type in an ingredient and I need the program to search through the Ingredients column in my data excel file. For example, the user wants to look for recipe that contains ORANGE JUICE in the ingredient list. If the ingredient is found in a cell, say E5, then I need to have a code that would be able...
0
8399
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.