473,799 Members | 2,665 Online
Bytes | Software Development & Data Engineering Community
+ 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 3976
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*****@discuss ions.microsoft. comschreef in
bericht news:96******** *************** ***********@mic rosoft.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*****@discuss ions.microsoft. comschreef in
bericht news:96******** *************** ***********@mic rosoft.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.mic rosoft.comschre ef in
bericht news:F4******** *************** ***********@mic rosoft.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*****@discuss ions.microsoft. comschreef in
bericht news:96******** *************** ***********@mic rosoft.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.mic rosoft.comschre ef in
bericht news:2E******** *************** ***********@mic rosoft.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.Co unt - 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
3845
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? CREATE TABLE mytable ( id INTEGER NOT NULL AUTO_INCREMENT, active DATE DEFAULT ?????,
11
12485
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 with a query but don't know what the criteria needs to be. Any help would be appreciated, Thanks
2
1813
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 current promised ate from a supplier. In an ideal world these two dates will always be the same, but in reality the delivery date will change. Therefore I want to set the currentpromisedate to default to the 1stPromiseDate value. I need
1
1514
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 date/time format sitewide ("MM/dd/yyyy HH:mm:ss") and I don't want to have to write that each time I have to format a date to string. I googled CurrentCulture and Date Format, and I found some articles on customizing the default culture of your...
2
11515
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: CAST(O.MYDATE AS CHAR(30)) When directly updating date fields in the main table, the logged value gets saved in the format YYYY-MM-DD as expected.
3
2389
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 date to be the previous Saturday, Sept 23 or if I enter data on Friday, Sept 29, the default date should also be Saturday, Sept 23. Is there a way to do this with date math, since the input date could be any date from the 23rd through the 29th. ...
3
25754
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 char(50) default 'Unknown', City char(50) default 'Mumbai',
2
3334
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 to populate a MS-Access database table in a column named DOB whose data type is Date/Time. There's another page named, say, MyPage.asp, in the same application where users have to again enter their date of birth. Like the registration page,...
4
3386
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 example: on my form, the first control is bound to a date/ time field and has a default value of now(). When users need to change this control's data, they'll most commonly need to alter the time part leaving the date as is. But, on a new record, when...
7
4927
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 date field in the database should be the current date. How can I do this in the Mysql database itself, so that each time my application is called the current date appears by default. Thanks in advance for your replies
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10269
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6811
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
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 we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.