473,414 Members | 1,622 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.

Update Dataset oleDB

Here is my code:

Dim wwtID as integer
Dim wwtEmailAddress as string
Dim drEmailListWWT as System.Data.DataRowView
Dim dvEmailListWWT as DataView
Dim cnEmailListWWT as OleDbConnection
Dim daEmailListWWT as OleDbDataAdapter = New OleDbDataAdapter
Dim dsEmailListWWT as DataSet = New DataSet
Dim SelectStatement as String

SelectStatement = "Select * From EmailList"
cnEmailListWWT = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Inetpub\wwwroot\WildWestTown\wwtdb\WWTEm ailList.mdb")
daEmailListWWT.UpdateCommand = New OleDbCommand(SelectStatement,
cnEmailListWWT)
daEmailListWWT.SelectCommand = New OleDbCommand(SelectStatement,
cnEmailListWWT)
daEmailListWWT.Fill(dsEmailListWWT, "EmailList")
dvEmailListWWT = dsEmailListWWT.Tables("EmailList").DefaultView
iLoop = 0
While dvEmailListWWT.count > iLoop
drEmailListWWT=dvEmailListWWT.Item(iLoop)
drEmailListWWT("wwtEmail") = Replace(drEmailListWWT("wwtEmail"), " ", "")

iLoop += 1
End While

daEmailListWWT.Update(dsEmailListWWT, "EmailList")

Here is my error:

Concurrency violation: the UpdateCommand affected 0 of the expected 1
records

Please help.
Jun 23 '06 #1
1 1095
Hi Mark,
daEmailListWWT.UpdateCommand = New OleDbCommand(SelectStatement,
cnEmailListWWT)
Are you using SelectStatement as the update command?

Ken
Microsoft MVP [ASP.NET]

"Mark Sandfox" <No****@NoSpam.com> wrote in message
news:aS********************@newssvr13.news.prodigy .com... Here is my code:

Dim wwtID as integer
Dim wwtEmailAddress as string
Dim drEmailListWWT as System.Data.DataRowView
Dim dvEmailListWWT as DataView
Dim cnEmailListWWT as OleDbConnection
Dim daEmailListWWT as OleDbDataAdapter = New OleDbDataAdapter
Dim dsEmailListWWT as DataSet = New DataSet
Dim SelectStatement as String

SelectStatement = "Select * From EmailList"
cnEmailListWWT = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Inetpub\wwwroot\WildWestTown\wwtdb\WWTEm ailList.mdb")
daEmailListWWT.UpdateCommand = New OleDbCommand(SelectStatement,
cnEmailListWWT)
daEmailListWWT.SelectCommand = New OleDbCommand(SelectStatement,
cnEmailListWWT)
daEmailListWWT.Fill(dsEmailListWWT, "EmailList")
dvEmailListWWT = dsEmailListWWT.Tables("EmailList").DefaultView
iLoop = 0
While dvEmailListWWT.count > iLoop
drEmailListWWT=dvEmailListWWT.Item(iLoop)
drEmailListWWT("wwtEmail") = Replace(drEmailListWWT("wwtEmail"), " ", "")

iLoop += 1
End While

daEmailListWWT.Update(dsEmailListWWT, "EmailList")

Here is my error:

Concurrency violation: the UpdateCommand affected 0 of the expected 1
records

Please help.

Jun 24 '06 #2

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

Similar topics

2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
2
by: Joe Fetters via .NET 247 | last post by:
Have googled and read the VS.NET documentation can't seem to getthe answer to the following. Environment: Framework 1.1 VB.NET WinForm Access database Using all automagic tools (DataAdapter...
6
by: Brett | last post by:
Not sure what the problem is here... Trying to update from a datagrid to an access database using vb.net... Its not updating the database but Im not getting any errors... Here is my code... ...
12
by: Gary Paris | last post by:
I have enclosed the sample code that I created. I want to read in employee data, and modify a few fields. I have tried to globally declare the objects that I need but I still am having problems. ...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
4
by: George | last post by:
Hi all, I am having trouble with updating my data in an Access database. here is my code: Imports System.Data.OleDb Dim AppPath As String = Mid(Application.ExecutablePath, 1,...
15
by: Scotty | last post by:
I like to have a good insert, update and delete code The code below sometimes workl ok sometimes doesnt work, what i am doing wrong?? Sub SaveAny() Dim command_builder As New...
11
by: John | last post by:
Hi I had a working vs 2003 application with access backend. I added a couple fields in a table in access db and then to allow user to have access to these fields via app I did the following; ...
3
by: =?Utf-8?B?TXJrIEJsYWNrYWxs?= | last post by:
Hi all, This is my first attempt to update an access database in VB.Net 2005. It goes broadly as follows (I have condensed it): Dim MyConnection As New Data.OleDb.OleDbConnection...
0
by: tom | last post by:
When I try to read in a csv file it gives me this error message. 'Cannot update. Database or object is read-only.' If I change the extension to txt it processes just fine. I have googled all...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
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.