Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Problem in SQL2000 1

Status
Not open for further replies.

ArthurLiu88

Programmer
Aug 5, 2006
16
CN
Hi
I'm a beginner with SQL2000. I have some questions about DATE field.

1 When I leave the date field blank, it returns '01/01/1900 00:00:00' after requery(). I'm using remote view and binded the cursor in the grid. How can I avoid this situation and just return ' / / ' like in VFP.
2 Some fields like birthday, I just need date part instead of date + time, how could I do in the grid. I mean I will update this field in the grid.
3 Does later version of SQL supports date type not only datetime?

Many thanks
Arthur Liu (Shanghai, China)
 
Artur,
SQL Server has no date type it uses only DATETIME. Also it has no empty datetime. All datetime fields begins from 01/01/1900 00:00:00.
What I do:
1. make ALL DateTime fields to accept NULLs. If you have EMPTY datetime in Fox send NULL instead.
2. I use CursorAdapters to manage SQL Server data. CA has one great property named ConvertionFunc. I set it for all my datetime fields to convert empty dates to NULLs.
3. When I nedd only Date portion I use CursorSchema and bind DateTime to Date type field.

You could MAP datetime field to Date in RemoteView also:
Go to View designer, Click on DateTime field and press Properties button. Then In Data Mapping select Date.
Before you TableUpdate() view make sure ALL EMPTY dates are replaced with NULLs.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Thanks Borislav
Clearly explanation and good suggestion, I give you a star.
Next step, I will learn CA.

Arthur Liu (Shanghai, China)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top