Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reading Excel data conditionally using ADO

Posted on 2004-04-13
3
Medium Priority
?
509 Views
Last Modified: 2012-06-21
I m tring to read data from an excel sheet conditionally. for eg i want to read all fields from the excel sheet where the date is '4/4/2004' or may be greater than or lesser than that date . I am unable to do so.

I m using ADO.

the query i m using is "select * from [ESTROCIT$] where oc_no=38 and oc_dt = '4/12/2004'"

but the error i get is  "Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression."

could ne one give me ne pointers?
0
Comment
Question by:shraddha_brains
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
zastil earned 150 total points
ID: 10811888
Not sure but try replacing ' with #

i.e. "select * from [ESTROCIT$] where oc_no=38 and oc_dt = #4/12/2004#"
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 10811942
You will get that error if all the cols you are searching by are not the same datatype. Ie if the date col has some blanks or text in the first 8 rows it does not see it as a data and so will return errors like you have above.

Try this first to see if you get the error:
"select * from [ESTROCIT$] where oc_no=38"
then
"select * from [ESTROCIT$] where oc_no='38'"
etc, extend it up then to see if it is the date...
0
 

Author Comment

by:shraddha_brains
ID: 10812137
Thanks zastil. the answer seems so easy. :-) my code now works fine

HI slim shaneey, thanks for ur thoughful answer. i did check accordingly and things were all right. ne ways the code worked fine with zastil's suggestion.

thanks all.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question