473,387 Members | 1,742 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,387 software developers and data experts.

Problem updating access table

When I execute the following, it finishes without error, but the field
dateOfInspection remains unchanged. I've verified that the values assigned
to parameters (held in mRow) are correct and that the connection string is
correct and the connection is open. What can I possibly be doing wrong
here?

Dim cmd As New OleDbCommand("update cert set dateofinspection=@dof where
id=@id", cnnData)
With cmd
.CommandText = "update cert set dateofinspection=@dof where id=@id"
.Parameters.Add("@id", OleDbType.BigInt)
.Parameters.Add("@dof", OleDbType.Date)
.Parameters("@id").Value = mRow.Item("id")
.Parameters("@dof").Value = mRow("dateofinspection")
.ExecuteNonQuery()
End With
Nov 21 '05 #1
8 1612
No, the code does not contain .commandtext= ... This is a typo in my post.
The code really is:

Dim cmd As New OleDbCommand("update cert set dateofinspection=@dof where
id=@id", cnnData)
With cmd
.Parameters.Add("@id", OleDbType.BigInt)
.Parameters.Add("@dof", OleDbType.Date)
.Parameters("@id").Value = mRow.Item("id")
.Parameters("@dof").Value = mRow("dateofinspection")
.ExecuteNonQuery()
End With
Nov 21 '05 #2
Jeremy,

A very easy one. When you look in ADONET you can see a long thread about
this done in the last few days. (Involved the OP, Scott M, Bill Vaughn and
slightly me)

The OleDb parameters have not in all cases not named parameters. (I try
telling it based on the thread however somebody proved in my opinion "never"
at the end, as is my assumption as well).

Try it this way.

Dim cmd As New OleDbCommand("update cert set dateofinspection=? where
id=?", cnnData)
With cmd
.CommandText = "update cert set dateofinspection=? where id=?"
.Parameters.Add("", OleDbType.Date)
.Parameters.Add("", OleDbType.BigInt)
.Parameters(0).Value = mRow("dateofinspection")
.Parameters(1).Value = mRow.Item("id")
.ExecuteNonQuery()
End With

(typed and changed in this message not really checked so watch typos or
other things)

Those names are no problem by the way, however nothing is done with it.

I hope this helps,

Cor

Nov 21 '05 #3
Jeremy,

At almost the same time I answered a question from somebody in the
newsgroup.

microsoft.public.dotnet.framework.adonet.

His name is Jeremy, I thought it was the same, now I see it are two
different persons.

However I assumed that you was well informed about this newsgroup.

Cor
Nov 21 '05 #4
Cor, I'm not able to find this thread. Can you give me the subject?
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Jeremy,

A very easy one. When you look in ADONET you can see a long thread about
this done in the last few days. (Involved the OP, Scott M, Bill Vaughn
and slightly me)

The OleDb parameters have not in all cases not named parameters. (I try
telling it based on the thread however somebody proved in my opinion
"never" at the end, as is my assumption as well).

Try it this way.

Dim cmd As New OleDbCommand("update cert set dateofinspection=? where
id=?", cnnData)
With cmd
.CommandText = "update cert set dateofinspection=? where id=?"
.Parameters.Add("", OleDbType.Date)
.Parameters.Add("", OleDbType.BigInt)
.Parameters(0).Value = mRow("dateofinspection")
.Parameters(1).Value = mRow.Item("id")
.ExecuteNonQuery()
End With

(typed and changed in this message not really checked so watch typos or
other things)

Those names are no problem by the way, however nothing is done with it.

I hope this helps,

Cor

Nov 21 '05 #5
Cor, I changed the code as you describe, but the result is the same.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Jeremy,

A very easy one. When you look in ADONET you can see a long thread about
this done in the last few days. (Involved the OP, Scott M, Bill Vaughn
and slightly me)

The OleDb parameters have not in all cases not named parameters. (I try
telling it based on the thread however somebody proved in my opinion
"never" at the end, as is my assumption as well).

Try it this way.

Dim cmd As New OleDbCommand("update cert set dateofinspection=? where
id=?", cnnData)
With cmd
.CommandText = "update cert set dateofinspection=? where id=?"
.Parameters.Add("", OleDbType.Date)
.Parameters.Add("", OleDbType.BigInt)
.Parameters(0).Value = mRow("dateofinspection")
.Parameters(1).Value = mRow.Item("id")
.ExecuteNonQuery()
End With

(typed and changed in this message not really checked so watch typos or
other things)

Those names are no problem by the way, however nothing is done with it.

I hope this helps,

Cor

Nov 21 '05 #6
"Jeremy" <je****@ninprodata.com> schrieb
No, the code does not contain .commandtext= ... This is a typo in my
post. The code really is:

Dim cmd As New OleDbCommand("update cert set dateofinspection=@dof
where id=@id", cnnData)
With cmd
.Parameters.Add("@id", OleDbType.BigInt)
.Parameters.Add("@dof", OleDbType.Date)
.Parameters("@id").Value = mRow.Item("id")
.Parameters("@dof").Value = mRow("dateofinspection")
.ExecuteNonQuery()
End With

What is the return value of ExecuteNonQuery?

debug.writeline(.ExecuteNonQuery())

As Cor has already mentioned, there's also an ADO.Net group:
microsoft.public.dotnet.framework.adonet

Armin
Nov 21 '05 #7
Armin, .executenonquery() returns 0.

"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
"Jeremy" <je****@ninprodata.com> schrieb
No, the code does not contain .commandtext= ... This is a typo in my
post. The code really is:

Dim cmd As New OleDbCommand("update cert set dateofinspection=@dof
where id=@id", cnnData)
With cmd
.Parameters.Add("@id", OleDbType.BigInt)
.Parameters.Add("@dof", OleDbType.Date)
.Parameters("@id").Value = mRow.Item("id")
.Parameters("@dof").Value = mRow("dateofinspection")
.ExecuteNonQuery()
End With

What is the return value of ExecuteNonQuery?

debug.writeline(.ExecuteNonQuery())

As Cor has already mentioned, there's also an ADO.Net group:
microsoft.public.dotnet.framework.adonet

Armin

Nov 21 '05 #8
Cor, now I see what you mean. You've gotta put the params in the right
sequence, since the data provider is too dumb to recognize their names. If
I was the flamin' kinda guy, I'd give MS an earful right now. How much
would it cost them to put something in their dox like "oh, by the way,
parameters are positional, not named". AAAARGH.

Jeremy

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Jeremy,

A very easy one. When you look in ADONET you can see a long thread about
this done in the last few days. (Involved the OP, Scott M, Bill Vaughn
and slightly me)

The OleDb parameters have not in all cases not named parameters. (I try
telling it based on the thread however somebody proved in my opinion
"never" at the end, as is my assumption as well).

Nov 21 '05 #9

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

Similar topics

6
by: Brent | last post by:
I've got a site that uses ASP pages to make simple connections to an Access 2000 database. The site has been fine for the past few months. Last night I browsed to an ASP page, and for some reason...
4
by: Frnak McKenney | last post by:
I'm using an in-core DataSet as an image of my application's 'database' (a multi-table Access97 mdb file). Updates are made to the DataTables within the DataSet via forms with bound TextBoxes,...
2
by: Earl Anderson | last post by:
I recall in my Paradox days that when appending records to a table or updating records and data type conflicts or key violations were automatically placed in tables called "Problem" or "Key_Viol". ...
6
by: John Baker | last post by:
Hi: As those who have looked at this newsgroup recently will realize, I am a neophyte with Access, although I have experienced with Approach (the Lotus product). There are things I could easily...
3
by: Katy | last post by:
In my project I have two tables with the same structure and second table's data is a part of the first one. (one is the main and the second is used to keep the results of filters performed on the...
0
by: | last post by:
I am updating MS access tables with data in an xml document. I create two dataset, one for existing data and one for new data. I fill the first dataset with the records from MS Access, the second...
1
by: Mark | last post by:
I'm having a problem updating recordsin an Access DB table. I can update other tables in this db with no problem, and I can dreate new record in all of the tables (including this one.)> But I can't...
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...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
2
by: Alexey.Murin | last post by:
The application we are developing uses MS Access 2003 database (with help of ADO). We have noticed that during massive records updating the size of the mdb file increases dramatically (from 3-4 to...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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...

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.