473,465 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Default date

Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default date I
save 1/1/1500 so when i find that date agian I know its a blank date.

Now The problem is when i attach Dataset to a datagridview, grid will show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds 1/1/1500
as date.
Thanks for any answers

Jul 19 '06 #1
9 3959
Rizwan,

Is there any reason that you use 1/1/1500 the nothing date in net is
01/01/00 and in Access 01/01/1753 (Eu and US notation)

A null value in the database is as well very well because you can use that
in the gridstyles or in the bindingevents.

Cor
"Rizwan Karedoa" <Rizwan Ka*****@discussions.microsoft.comschreef in
bericht news:96**********************************@microsof t.com...
Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default date I
save 1/1/1500 so when i find that date agian I know its a blank date.

Now The problem is when i attach Dataset to a datagridview, grid will show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds 1/1/1500
as date.
Thanks for any answers

Jul 19 '06 #2
Hi Cor Ligthert,
Thanks for ur reply, there is no particulat reason for me to use 1/1/1500 as
default date.

I tried what you suggested, I set date to nothing so when it saved in
database the value it got was 12:00:00am which is normal.

But then i load that into a datagrid then i see the date as 30/12/1899.
Is there any way to check if the date is 30/12/1899 then show blank in
datagrid.

or someother way to achive that.
Thanks

"Cor Ligthert [MVP]" wrote:
Rizwan,

Is there any reason that you use 1/1/1500 the nothing date in net is
01/01/00 and in Access 01/01/1753 (Eu and US notation)

A null value in the database is as well very well because you can use that
in the gridstyles or in the bindingevents.

Cor
"Rizwan Karedoa" <Rizwan Ka*****@discussions.microsoft.comschreef in
bericht news:96**********************************@microsof t.com...
Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default date I
save 1/1/1500 so when i find that date agian I know its a blank date.

Now The problem is when i attach Dataset to a datagridview, grid will show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds 1/1/1500
as date.
Thanks for any answers


Jul 19 '06 #3
Hello Rizwan,

Set the database to allow null values in the date fields. Then pass DbNull.Value
into the database for dates that are not available.

-Boo
Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default
date I
save 1/1/1500 so when i find that date agian I know its a blank date.
Now The problem is when i attach Dataset to a datagridview, grid will
show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds
1/1/1500
as date.
Thanks for any answers

Jul 19 '06 #4
Hi GhostInAK,
Whwn I am passing the values in access in update query i write
mydate = #" & dbnull.value & "#

this generates an error.
Syntax error in date field in query expression '##'

So that doesn't work.
Thanks for help

"GhostInAK" wrote:
Hello Rizwan,

Set the database to allow null values in the date fields. Then pass DbNull.Value
into the database for dates that are not available.

-Boo
Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default
date I
save 1/1/1500 so when i find that date agian I know its a blank date.
Now The problem is when i attach Dataset to a datagridview, grid will
show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds
1/1/1500
as date.
Thanks for any answers


Jul 19 '06 #5
Hi

In your query string you just need to have

mydate = null

instead of
mydate = #" & dbnull.value & "#

Hope that helps
Martin

Rizwan Karedoa wrote:
Hi GhostInAK,
Whwn I am passing the values in access in update query i write
mydate = #" & dbnull.value & "#

this generates an error.
Syntax error in date field in query expression '##'

So that doesn't work.
Thanks for help

"GhostInAK" wrote:
Hello Rizwan,

Set the database to allow null values in the date fields. Then pass DbNull.Value
into the database for dates that are not available.

-Boo
Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default
date I
save 1/1/1500 so when i find that date agian I know its a blank date.
Now The problem is when i attach Dataset to a datagridview, grid will
show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds
1/1/1500
as date.
Thanks for any answers
Jul 19 '06 #6
Rizwan,

Reading as well your answer to GhostInAK you have a lot of problems with
dates in Net.

Have a look at these links to start with.

http://www.vb-tips.com/dbPages.aspx?...3-eb8b44af0137

And than this for your further problem

http://www.vb-tips.com/dbPages.aspx?...9-4deb7fa4a0b8

I hope this helps,

Cor

"Rizwan Karedoa" <Ri***********@discussions.microsoft.comschreef in
bericht news:F4**********************************@microsof t.com...
Hi Cor Ligthert,
Thanks for ur reply, there is no particulat reason for me to use 1/1/1500
as
default date.

I tried what you suggested, I set date to nothing so when it saved in
database the value it got was 12:00:00am which is normal.

But then i load that into a datagrid then i see the date as 30/12/1899.
Is there any way to check if the date is 30/12/1899 then show blank in
datagrid.

or someother way to achive that.
Thanks

"Cor Ligthert [MVP]" wrote:
>Rizwan,

Is there any reason that you use 1/1/1500 the nothing date in net is
01/01/00 and in Access 01/01/1753 (Eu and US notation)

A null value in the database is as well very well because you can use
that
in the gridstyles or in the bindingevents.

Cor
"Rizwan Karedoa" <Rizwan Ka*****@discussions.microsoft.comschreef in
bericht news:96**********************************@microsof t.com...
Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default
date I
save 1/1/1500 so when i find that date agian I know its a blank date.

Now The problem is when i attach Dataset to a datagridview, grid will
show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds
1/1/1500
as date.
Thanks for any answers



Jul 19 '06 #7
Hi Pritcham,
I am able to save a null date to access database, and the value i can see
there is 12:00:00am.

The problem now I have is when i write a query to load in datagridview , the
value I see in datagrisview is 30/12/1899 .
I don't want to show any value for null date in grid , it should be blank.

Thanks for all ur help and replies.

"Pritcham" wrote:
Hi

In your query string you just need to have

mydate = null

instead of
mydate = #" & dbnull.value & "#

Hope that helps
Martin

Rizwan Karedoa wrote:
Hi GhostInAK,
Whwn I am passing the values in access in update query i write
mydate = #" & dbnull.value & "#

this generates an error.
Syntax error in date field in query expression '##'

So that doesn't work.
Thanks for help

"GhostInAK" wrote:
Hello Rizwan,
>
Set the database to allow null values in the date fields. Then pass DbNull.Value
into the database for dates that are not available.
>
-Boo
>
Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default
date I
save 1/1/1500 so when i find that date agian I know its a blank date.
Now The problem is when i attach Dataset to a datagridview, grid will
show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds
1/1/1500
as date.
Thanks for any answers
>
>
>

Jul 20 '06 #8
Rizwan,

Don't trust the VBNet debugger about dates and times, it is giving a
translated DateTime in US notation, which is in my opinion very confusing
outside the US. The C# debugger does it correct.

Cor

"Rizwan Karedoa" <Ri***********@discussions.microsoft.comschreef in
bericht news:2E**********************************@microsof t.com...
Hi Pritcham,
I am able to save a null date to access database, and the value i can see
there is 12:00:00am.

The problem now I have is when i write a query to load in datagridview ,
the
value I see in datagrisview is 30/12/1899 .
I don't want to show any value for null date in grid , it should be blank.

Thanks for all ur help and replies.

"Pritcham" wrote:
>Hi

In your query string you just need to have

mydate = null

instead of
mydate = #" & dbnull.value & "#

Hope that helps
Martin

Rizwan Karedoa wrote:
Hi GhostInAK,
Whwn I am passing the values in access in update query i write
mydate = #" & dbnull.value & "#

this generates an error.
Syntax error in date field in query expression '##'

So that doesn't work.
Thanks for help

"GhostInAK" wrote:

Hello Rizwan,

Set the database to allow null values in the date fields. Then pass
DbNull.Value
into the database for dates that are not available.

-Boo

Hi experts,
I am developing an application, I am using vb 2005 and access.
I have many date fields, When I am saving through Query for default
date I
save 1/1/1500 so when i find that date agian I know its a blank
date.
Now The problem is when i attach Dataset to a datagridview, grid
will
show
date 1/1/1500, I don't want to show that date to user.
Is there any way I can have blank date in data grid when it finds
1/1/1500
as date.
Thanks for any answers


Jul 20 '06 #9
Thanks Guys for all your help.
I solved the problem, I am posting this so that if someone is having similar
problem then he can use this.

i created a sub routine and called this sub just after assigning dataset to
datagrid.

Private Sub FilterDatefield(ByVal columnNumber As Int16)
Dim i As Integer
For i = 0 To grdJobs.Rows.Count - 1
If grdJobs.Rows(i).Cells(3).Value = "1/01/1500" Then
grdJobs.Rows(i).Cells(3).Value = ""
End If
Next
End Sub

thanks again.
Bye

Jul 20 '06 #10

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

Similar topics

2
by: Rob | last post by:
Hello all I have a field (called active) of type DATE and I want to add a default value. The default value must be the current date. Is this possible to do this in the table create statement? ...
11
by: David Messner | last post by:
Ok I know this is simple but the statement eludes me... I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this...
2
by: hyphen | last post by:
I have set up two date fields in a table: 1stpromisedDate and CurentPromisedDate The first field is to record the 1st promised delivery date of a supplier and the second is to record the...
1
by: Tom | last post by:
I need to modify the default behavior of Date.ToString() on all pages of my ASP.Net (2.0) site. I don't need to localize my app (it's an intranet-only site), but I need to enforce a specific...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
3
by: dpmcdoug | last post by:
I am a relative novice with Access and I am developing an input form that I need a default date to populate, regardless of the input date e.g. If I input data on Tuesday, Sept 27, I want the default...
3
by: zufie | last post by:
I want to use SQL code to Create a Table & Provide a Default Value for Each Column. Here is the code I am using: CREATE TABLE customer (First_Name char(50), Last_Name char(50), Address...
2
by: rn5a | last post by:
During registration, users have to provide their date of birth. For the date & month part, there are 2 dropdown lists & for the year, there's a textbox. These 3 fields are finally merged together...
4
by: helenwheelss | last post by:
Access 2003, using a bound form. I'm seeing rather annoying behaviour when editing data in a control with a default value. It only happens when the form is on a new record. A specific...
7
by: sharmilah | last post by:
Hi all It's me again. I now want to specify the current date in the format '26/06/2007' ie date/month/year as the default value in my mysql database. Which implies that by default the value of my...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.