?
Solved

Reading Excel data conditionally using ADO

Posted on 2004-04-13
3
Medium Priority
?
501 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 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