PC Review


Reply
Thread Tools Rate Thread

Access db problem from .NET

 
 
Lars Netzel
Guest
Posts: n/a
 
      24th May 2004
I have a small application that will copy two tables from one access databas
to another, the tables are present in the destination database and I only
copy the data over. So there is no created on the databases. I do this by
filling a DataSet and then Copy() to another Dataset and Update() the
destination Database's Adapter

Everything works fine except for ONE thing...

One field is of Date/Time type and when I copy ONLY the Date is copied over
the right way and not the time... the time turns into 00:00:00 on all the
records but the Date is correct!

for example
2004-05-24 08:10:03 will turn into -> 2004-05-24 00:00:00

Any idea what this can come of?

Best Regards
/Lars


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      24th May 2004
Hi Lars,

Not that I know the answer direct however is your copy only a

datatablenew = datatableold.copy

Or do you use another method?

Cor


 
Reply With Quote
 
Lars Netzel
Guest
Posts: n/a
 
      24th May 2004

Yes that's how I copy... but I actually copy on the Dataset level, the
dataset contains both Tables then..

So it'd be:

DatasetNew = DatasetOld.Copy()

/Lars

"Cor Ligthert" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> Hi Lars,
>
> Not that I know the answer direct however is your copy only a
>
> datatablenew = datatableold.copy
>
> Or do you use another method?
>
> Cor
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      24th May 2004
Hi Lars,

I tested this
\\\
Dim ds As New DataSet
Dim dt As New DataTable
Dim dc As New DataColumn
dc.DataType = GetType(DateAndTime)
dt.Columns.Add(dc)
ds.Tables.Add(dt)
Dim dr As DataRow = dt.NewRow
dr(0) = Now
ds.Tables(0).Rows.Add(dr)
MessageBox.Show(ds.Tables(0).Rows(0)(0).ToString)
Dim dsnew As New DataSet
dsnew = ds.Copy
MessageBox.Show(dsnew.Tables(0).Rows(0)(0).ToString)
///
They both give the same date and time,

What do I not understand?

Cor


 
Reply With Quote
 
Lars Netzel
Guest
Posts: n/a
 
      24th May 2004
Not sure..

In the database though the there are two fileds (of which I am NOT in charge
of designing).

"Date" and "TimeWritten"

Both are of Date/time type but in the "Date" field there's only a datevalue
when createing the record amd in the "TimeWritten" only a Timevalue is
written... I'm thinking maybe this is wrong?

What I mean is that when the record is created the "date" field get this
information "2005-05-24" while the "TimeWritten" only get "08:10:03" ....

I myself think it's unnessessarry to have two fields for this but I can't
really change that and it's a strnge error anyway..

/Lars



"Cor Ligthert" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> Hi Lars,
>
> I tested this
> \\\
> Dim ds As New DataSet
> Dim dt As New DataTable
> Dim dc As New DataColumn
> dc.DataType = GetType(DateAndTime)
> dt.Columns.Add(dc)
> ds.Tables.Add(dt)
> Dim dr As DataRow = dt.NewRow
> dr(0) = Now
> ds.Tables(0).Rows.Add(dr)
> MessageBox.Show(ds.Tables(0).Rows(0)(0).ToString)
> Dim dsnew As New DataSet
> dsnew = ds.Copy
> MessageBox.Show(dsnew.Tables(0).Rows(0)(0).ToString)
> ///
> They both give the same date and time,
>
> What do I not understand?
>
> Cor
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Access 2003 User Security DB opening with Access 2007 Donna Microsoft Access Security 4 20th May 2010 05:58 PM
Access 97 Upgraded to Access 2007 User level security problem Derek Curtis Microsoft Access Security 3 6th Sep 2008 05:50 AM
[Access 2007] Problem to disable the Close Button (X) on the Access Application Window David Berthemet Microsoft Access 0 28th Feb 2007 11:33 AM
Access 2003: Problem with Access.Application object when user not logged in Henk Microsoft Access Reports 1 9th Mar 2006 01:57 AM
Problem running Access 2003 and Access 2000 apps on same machine. Rathtap Microsoft Access 3 13th Jun 2004 01:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:20 PM.