| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi guys,
I am new to this ASP language, I want some script to do this: User search thorugh a form, then the script extracts the data required from an Microsoft Excel file, and finally outputs on a HTML or some page. I worked with Php, but never touched ASP. So, please help me, My Boss needs me to do this.... Thank you for your help Srinath |
|
#2
|
|||
|
|||
|
multiple methods to accomplish this task.
Try something like this in your asp page or try creating a odbc
and accessing it that way! <% Dim oComm, oRs set oRs = CreateObject("ADODB.Recordset") set oConn = Server.CreateObject("ADODB.Connection") oconn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _ "DriverId=790;" & _ "Dbq=e:\production\;" & _ "DefaultDir=e:\production" oRs.Open "Select * From gow0433_call_list.xls", oConn, adOpenForwardOnly, adLockReadOnly Do while not oRs.EOF Response.Write oRs("phone") oRs.movenext Loop %> |
|
#3
|
|||
|
|||
|
I tried this code but cannot get it to work! Perhaps you could explain the connection object further?? I tried 2 other connection objects:
strConn = "Driver={Microsoft Excel Driver (*.xls)};DBQ=c:\Excel\Test.xls" strConn="Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\Excel\test.xls;Defaul tDir=c:\excel" These seemed to work. However, when I did the sql query -- Select * from test.xls" it kept telling me that it couldn't find this object. I tried all fully qualified names, putting in the wwwroot directory, etc. Nothing would work. I would love to use this code if you are sure it works. Maybe there was a small detail left out?? Please help me!! 8-( Thanks. |
|
#4
|
||||
|
||||
|
Nope, looks like he got it right ... here more connection examples ... they are actually easy to find on the web, just one of many:
http://www.simongibson.com/intranet/adoodbc/ maybe you have a typo somewhere in your statement. Try testing each statement one by one by inserting debug code (response.write if you need to) to be sure you have a valid object (i.e response write a property of the connection strConn to be sure it was really created) |
|
#5
|
||||
|
||||
|
Also ... the Excel Driver has to be on your webserver, of course. Many times apps typically installed on our workstation are not installed on a webserver, such as MS Office products so check that first.
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Search from Excel files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|