Home All Groups Group Topic Archive Search About
Author
19 Jul 2006 6:15 AM
Rizwan Karedoa
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

Author
19 Jul 2006 6:25 AM
Cor Ligthert [MVP]
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


Show quoteHide quote
"Rizwan Karedoa" <Rizwan Kare***@discussions.microsoft.com> schreef in
bericht news:965301B4-82FC-4125-95D2-58B5C596D13C@microsoft.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
>
Author
19 Jul 2006 6:44 AM
Rizwan Karedoa
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

Show quoteHide quote
"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 Kare***@discussions.microsoft.com> schreef in
> bericht news:965301B4-82FC-4125-95D2-58B5C596D13C@microsoft.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
> >
>
>
>
Author
19 Jul 2006 9:28 AM
Cor Ligthert [MVP]
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?ID=550279ec-6767-44ff-aaa3-eb8b44af0137

And than this for your further problem

http://www.vb-tips.com/dbPages.aspx?ID=c4832a2a-2b95-4ded-93d9-4deb7fa4a0b8

I hope this helps,

Cor

Show quoteHide quote
"Rizwan Karedoa" <RizwanKare***@discussions.microsoft.com> schreef in
bericht news:F4762EC9-C0DC-424F-A9D9-0F6A21EB56E5@microsoft.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 Kare***@discussions.microsoft.com> schreef in
>> bericht news:965301B4-82FC-4125-95D2-58B5C596D13C@microsoft.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
>> >
>>
>>
>>
Author
19 Jul 2006 7:08 AM
GhostInAK
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

Show quoteHide quote
> 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
Author
19 Jul 2006 7:31 AM
Rizwan Karedoa
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

Show quoteHide quote
"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
>
>
>
Author
19 Jul 2006 7:56 AM
Pritcham
Hi

In your query string you just need to have

mydate = null

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

Hope that helps
Martin

Rizwan Karedoa wrote:
Show quoteHide quote
> 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
> >
> >
> >
Author
20 Jul 2006 1:03 AM
Rizwan Karedoa
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.

Show quoteHide quote
"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
> > >
> > >
> > >
>
>
Author
20 Jul 2006 2:51 AM
Cor Ligthert [MVP]
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

Show quoteHide quote
"Rizwan Karedoa" <RizwanKare***@discussions.microsoft.com> schreef in
bericht news:2E51BD87-1ACE-445B-A137-6EC086B97A73@microsoft.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
>> > >
>> > >
>> > >
>>
>>
Author
20 Jul 2006 6:31 AM
Rizwan Karedoa
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