473,378 Members | 1,383 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,378 software developers and data experts.

ASP and Excel

Hello,

in German ASP-Newsgroups nobody had an idea,
so I would like to ask the following here:

You can simply read the content of an Excel
worksheet via ASP by executing a sql-statement
like SELECT * FROM [Table1$A:E]

That works fine, but how can I search for one
special row for example ? I have tried
SELECT * FROM [Table1$A:E] WHERE [Table1$D] Like '" & searchstring & "%';
to search a string in column D, but it hadn't worked.
Anybody an idea ?

Maybe it is a question of the connection drivers ?
Should I use the Jet or the Excel drivers ? How
the connection-string would look like for the
sample above ?

Thanks for any help
Greetings
Thies
Jul 19 '05 #1
3 5782
Thies Meier wrote:
Hello,

in German ASP-Newsgroups nobody had an idea,
so I would like to ask the following here:

You can simply read the content of an Excel
worksheet via ASP by executing a sql-statement
like SELECT * FROM [Table1$A:E]

That works fine, but how can I search for one
special row for example ? I have tried
SELECT * FROM [Table1$A:E] WHERE [Table1$D] Like '" & searchstring &
"%'; to search a string in column D, but it hadn't worked.
Anybody an idea ?

Maybe it is a question of the connection drivers ?
Should I use the Jet or the Excel drivers ? How
the connection-string would look like for the
sample above ?

Thanks for any help
Greetings
Thies


I think you're going to have to use the recordset's Find or Filter method
(probably the latter) to accomplish this. Excel is not a database engine so
I would not expect it to support sql queries.

Bob Barrows
Jul 19 '05 #2
When I did this years ago I would name the table range then it thinks the
top row of the field is the column name. So
Select * from <mynamedrange> where <myfirstrow> Like '" & searchstring &
"%';

of course don't use Select * in production code.

HTH
Mike
"Thies Meier" <tm@sh-home.de> wrote in message
news:bj*************@news.t-online.com...
Hello,

in German ASP-Newsgroups nobody had an idea,
so I would like to ask the following here:

You can simply read the content of an Excel
worksheet via ASP by executing a sql-statement
like SELECT * FROM [Table1$A:E]

That works fine, but how can I search for one
special row for example ? I have tried
SELECT * FROM [Table1$A:E] WHERE [Table1$D] Like '" & searchstring & "%';
to search a string in column D, but it hadn't worked.
Anybody an idea ?

Maybe it is a question of the connection drivers ?
Should I use the Jet or the Excel drivers ? How
the connection-string would look like for the
sample above ?

Thanks for any help
Greetings
Thies

Jul 19 '05 #3
You need to know the name of the column. To find this you could get an
empty recordset based on the original query i.e.

SELECT * FROM [Table1$A:E] WHERE 0=1

Enumerate the recordset's Fields collection to determine the column
name, then plug this back into the WHERE clause of your original
query.

Use a connection string that looks like this:

Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\MyWorkbook.xls;Extended Properties=Excel 8.0

In other words, use the OLE DB provider for Jet.

"Thies Meier" <tm@sh-home.de> wrote in message news:<bj*************@news.t-online.com>...
Hello,

in German ASP-Newsgroups nobody had an idea,
so I would like to ask the following here:

You can simply read the content of an Excel
worksheet via ASP by executing a sql-statement
like SELECT * FROM [Table1$A:E]

That works fine, but how can I search for one
special row for example ? I have tried
SELECT * FROM [Table1$A:E] WHERE [Table1$D] Like '" & searchstring & "%';
to search a string in column D, but it hadn't worked.
Anybody an idea ?

Maybe it is a question of the connection drivers ?
Should I use the Jet or the Excel drivers ? How
the connection-string would look like for the
sample above ?

Thanks for any help
Greetings
Thies

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
6
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
22
by: Howard Kaikow | last post by:
There's a significant problem in automating Excel from VB .NET. Reminds me of a problem I encountered almost 3 years ago that was caused by the Norton Auntie Virus Office plug-in. Can anybody...
9
by: Anthony | last post by:
To me, creating Excel 2003 spreadsheets programmatically via VB.NET hasn't really changed since the days of VB6. That is, I'd do something similar to this Code: Dim ExcelApp As...
7
by: Alain \Mbuna\ | last post by:
Hi everybody. In my program I have some data that is calculated after some input from the user. I have written some code that opens an Excel workbook, with 5 worksheets and the calculated data...
16
by: alexia.bee | last post by:
Hi all, In some weird reason, excel instance won;t die if i remove the comment from 4 lines of setting values into struct. here is a snipcode public...
9
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.