473,723 Members | 2,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating Access Datetime field using OleDBDataAdapte r

RML
Hi everyone,

I am using VB.NET 2003 and an OleDBDataAdapte r 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 OleDBDataAdapte r 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.daTaskProces s.Update(Me.dsT askPro)

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 "Concurrenc y Violation" exception.

Amyone have any ideas?

Thanks RML

Nov 21 '05 #1
1 4784
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 OleDbDataAdapte r

dam = New OleDbDataAdapte r(strsqlselect, oconn)

Dim odsm As New DataSet("tblmin istryjoin")

dam.Fill(odsm, "tblministryjoi n")

Dim commandbuilder_ odsm As OleDbCommandBui lder = New
OleDbCommandBui lder(dam)

Dim irowm As DataRow

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

irowm("fromdate ") = Now

MessageBox.Show (Now)

MessageBox.Show (irowm("fromdat e"))

Exit For

Next

Try

dam.Update(odsm , "tblministryjoi n")

Catch ex As Exception

MessageBox.Show (ex.Message)

End Try

HTH,

Bernie Yaeger

"RML" <RM*@discussion s.microsoft.com > wrote in message
news:3F******** *************** ***********@mic rosoft.com...
Hi everyone,

I am using VB.NET 2003 and an OleDBDataAdapte r 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 OleDBDataAdapte r 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.daTaskProces s.Update(Me.dsT askPro)

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 "Concurrenc y 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
7828
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 the issue. I hope I've included all relevant information. On a form, I have a DateTimePicker with the following
2
1806
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 work_id of 1343. What Am I missing? Your help is appreciated. Irvin Amoraal. <>< ______________________ <%@ Page Language="VB" Debug="true" %> <%@ import Namespace="System.Data" %>
2
2404
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 first table. Both tables have a 'DateTime' field that shows when it was last updated using the Now function. What I am trying to do is get the 'DateTime' field updated after the append query copies it to the new table. I have tried updating...
1
1693
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 this connection string "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename and everything is working fine with that. My table in the database is simple. 10 columns of text or numbers. No joining or anything else. It has a autonumber as...
1
4477
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 help in advance.
1
3779
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 Yes/No value in Access. Using the OleDbCommand, if I do not consider the Yes/No field, the ExecuteNonQuery command, using my UPDATE SQL statement, updates the record correctly. However, if I put the Yes/No field into the mix, ExecuteNonQuery...
5
2034
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 one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
13
5326
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 40 of them throw Concurrency violation errors in the update, and my GetAllColErrs function provides no output. In comparing the rows that throw errors with those that do not, I could find no pattern. It is obviously a bogus error, as the...
4
2410
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 there anything that i can do to speed the app up a bit? namespace SQLToAccessBackup
0
8741
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
9388
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9241
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
9160
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
8062
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4504
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3209
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
3
2149
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.