473,507 Members | 3,678 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 1530
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
3517
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...
9
20260
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
3195
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...
2
4581
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,...
1
4834
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...
1
2709
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...
0
2118
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...
2
2265
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...
3
4128
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...
0
7223
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
7110
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
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7482
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...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
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...
0
1540
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 ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.