473,414 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Updating Access Datetime field using OleDBDataAdapter

RML
Hi everyone,

I am using VB.NET 2003 and an OleDBDataAdapter to update an Access table's
DateTime field. The field's format is set to "General Date" (ie: 11/24/2004
8:00:00 AM). The problem is the field ends up with only a date, with no time
component.

In my project...
I added an OleDBDataAdapter using the wizzard to my form. I generated the
DataSet and added the desired table. I verified the field type in the
DataSet is "dateTime".

My code does this...
Me.dsTaskPro(0).CompletedOn = Now
Me.daTaskProcess.Update(Me.dsTaskPro)

The field ends up with today's date "11/24/2004", with no time component.

If I edit the field (using Access) with a date & time, say 11/24/2004
8:00:00 AM and then run my code I get a "Concurrency Violation" exception.

Amyone have any ideas?

Thanks RML

Nov 21 '05 #1
1 4734
Hi RML,

The following code worked fine for me. Is it possible that your column is
not really a datetime column? Otherwise, I don't understand why you should
not be seeing the time. Are you displaying it in shortdatetime format?
strsqlselect = "select * from tblministryjoin order by todate"

Dim dam As OleDbDataAdapter

dam = New OleDbDataAdapter(strsqlselect, oconn)

Dim odsm As New DataSet("tblministryjoin")

dam.Fill(odsm, "tblministryjoin")

Dim commandbuilder_odsm As OleDbCommandBuilder = New
OleDbCommandBuilder(dam)

Dim irowm As DataRow

For Each irowm In odsm.Tables(0).Rows

irowm("fromdate") = Now

MessageBox.Show(Now)

MessageBox.Show(irowm("fromdate"))

Exit For

Next

Try

dam.Update(odsm, "tblministryjoin")

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

HTH,

Bernie Yaeger

"RML" <RM*@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com...
Hi everyone,

I am using VB.NET 2003 and an OleDBDataAdapter to update an Access table's
DateTime field. The field's format is set to "General Date" (ie:
11/24/2004
8:00:00 AM). The problem is the field ends up with only a date, with no
time
component.

In my project...
I added an OleDBDataAdapter using the wizzard to my form. I generated the
DataSet and added the desired table. I verified the field type in the
DataSet is "dateTime".

My code does this...
Me.dsTaskPro(0).CompletedOn = Now
Me.daTaskProcess.Update(Me.dsTaskPro)

The field ends up with today's date "11/24/2004", with no time component.

If I edit the field (using Access) with a date & time, say 11/24/2004
8:00:00 AM and then run my code I get a "Concurrency Violation" exception.

Amyone have any ideas?

Thanks RML

Nov 21 '05 #2

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

Similar topics

3
by: Jay | last post by:
I previously posted this question under Visual Basic newsgroup, but was advised to re-post here. I'm hoping someone can help me solve an issue I'm having with VB.Net and Access 2000. Here's...
2
by: Irvin | last post by:
I new to ASP.net and am using the following code to attempt to update an Access 2000 mdb. The code does make it through the code following "try". NO rows are updated. There is a row with the...
2
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the...
1
by: Bryan Masephol | last post by:
Hi All I have a OleDbConnection as the "connection" below. I'm retriving a dataset from an access 2002 db and displaying it in a DataGrid. I'm making the connection to my access db file with...
1
by: JH | last post by:
I have a comma delimited file and I want to export it to an MS access table already designed with appropriate field names. How do I do this programmatically using VB.NET or C#? Thanks for any...
1
by: Harry Devine | last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept correctly. My grid shows values from 5 database fields. I only need to update that last 4 fields. The last field is a...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
13
by: mfreeman | last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown below. All I do is loop through the records in the table and update them without making any changes. Out of 600 records, about...
4
by: RSH | last post by:
Hi, I have a situation where I have created a little application that makes an Access database from a SQL Database for reporting purposes. it does the job well, but it seems a bit slow. Is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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
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...

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.