date field problem

venky

Active member
Joined
Sep 12, 2005
Messages
27
Programming Experience
1-3
hi

I am run small sql command to extract the data from oracle from vb.net.But my problem is, while executing the command it displays the error msg as day of month should be 1 and last day of the month.but the same command execute on oracle it works very fine.What's the problem.

Please help me..
 

fpineda101

Well-known member
Joined
Nov 14, 2005
Messages
122
Location
Los Angeles, CA
Programming Experience
1-3
It sounds like your date control doesn't like the format of the date it is being given. In that case, you need to modify your query to something like this...

SELECT to_char(your_date, 'MM/dd/yyyy') FROM your_table

You may need to shorten the date to 'MM/dd/yy' depending the settings of your date control. Really vague post, this is the best answer I can give you right now...
 

zekeman

Well-known member
Joined
May 23, 2006
Messages
224
Programming Experience
10+
Sometimes:

VB.NET:
dim strSelect as string = "Select * from [table] where date = 
 
#12/30/2006#"

But I don't know if this applies to you.
 

venky

Active member
Joined
Sep 12, 2005
Messages
27
Programming Experience
1-3
hi

Actually the field in the oracle is date.

This is the way i am writing select * from faults where to_char(to_date(occured,'dd-mon-yy'),'dd-mon-yyyy')=to_char(to_date('"&date1&"','dd-mon-yy'),'dd-mon-yyyy')

This is working finein my office pc and not working in my home PC.The date format in both systems in control panel is same.
 

fpineda101

Well-known member
Joined
Nov 14, 2005
Messages
122
Location
Los Angeles, CA
Programming Experience
1-3
Are you using the exact same project on both PC's or a copy of one at the two locations? Are you simply loading the date into the DB and/or displaying it on your front end? If you are displaying the date, how so? Which control? What are the settings of the control?
 
Top Bottom