473,804 Members | 3,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataAdapter Update() Help

Does anyone know why the DA Update() would throw an exception?

I moved the database but I updated the Conn and the DA, currently
(trying)removin g/replacing DS. Is there a another direction I should be
looking in? Does it matter if I move columns in the grid (everything is a
string anyways)? Does the DS need to be udated from the DT?
***************
int rowNo = dg.CurrentRowIn dex;

dt = dt .Rows[rowNo].BeginEdit();
dt = dt .Rows[rowNo][columnName] = strgCellFill;
dt = dt .Rows[rowNo].EndEdit();

string s = dt.Rows[rowNo][columnName]; // s = strgCellFill

DataRow dr = dt.Rows[rowNo];
string s1 = dr.RowState.ToS tring(); // s1 = "Modified"

DS dataSetChanges = getDataSetChang es();

if (dataSetChanges .HasChanges())
{
this.Conn.Open( );
this.da.Update( ds); //throws an exception
this.Conn.Close ();
}
Nov 16 '05 #1
7 2582
What is the error message that comes with the exception ?

-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9
"Steve B." wrote:
Does anyone know why the DA Update() would throw an exception?

I moved the database but I updated the Conn and the DA, currently
(trying)removin g/replacing DS. Is there a another direction I should be
looking in? Does it matter if I move columns in the grid (everything is a
string anyways)? Does the DS need to be udated from the DT?
***************
int rowNo = dg.CurrentRowIn dex;

dt = dt .Rows[rowNo].BeginEdit();
dt = dt .Rows[rowNo][columnName] = strgCellFill;
dt = dt .Rows[rowNo].EndEdit();

string s = dt.Rows[rowNo][columnName]; // s = strgCellFill

DataRow dr = dt.Rows[rowNo];
string s1 = dr.RowState.ToS tring(); // s1 = "Modified"

DS dataSetChanges = getDataSetChang es();

if (dataSetChanges .HasChanges())
{
this.Conn.Open( );
this.da.Update( ds); //throws an exception
this.Conn.Close ();
}

Nov 16 '05 #2
It's a System.Data.Ole Db.OleDbExcepti on.

Looks like the database. Wouldn't the Open() fail if it was a problem with
the dB?

Should I recreate the Conn, DA and DS

Steve

"Steve B." wrote:
Does anyone know why the DA Update() would throw an exception?

I moved the database but I updated the Conn and the DA, currently
(trying)removin g/replacing DS. Is there a another direction I should be
looking in? Does it matter if I move columns in the grid (everything is a
string anyways)? Does the DS need to be udated from the DT?
***************
int rowNo = dg.CurrentRowIn dex;

dt = dt .Rows[rowNo].BeginEdit();
dt = dt .Rows[rowNo][columnName] = strgCellFill;
dt = dt .Rows[rowNo].EndEdit();

string s = dt.Rows[rowNo][columnName]; // s = strgCellFill

DataRow dr = dt.Rows[rowNo];
string s1 = dr.RowState.ToS tring(); // s1 = "Modified"

DS dataSetChanges = getDataSetChang es();

if (dataSetChanges .HasChanges())
{
this.Conn.Open( );
this.da.Update( ds); //throws an exception
this.Conn.Close ();
}

Nov 16 '05 #3
Could it have to do with folder permissions? the properties -security tab
Allow column is checked?? NFTS?? ASPNET permissions?

Steve

"Steve B." wrote:
It's a System.Data.Ole Db.OleDbExcepti on.

Looks like the database. Wouldn't the Open() fail if it was a problem with
the dB?

Should I recreate the Conn, DA and DS

Steve

"Steve B." wrote:
Does anyone know why the DA Update() would throw an exception?

I moved the database but I updated the Conn and the DA, currently
(trying)removin g/replacing DS. Is there a another direction I should be
looking in? Does it matter if I move columns in the grid (everything is a
string anyways)? Does the DS need to be udated from the DT?
***************
int rowNo = dg.CurrentRowIn dex;

dt = dt .Rows[rowNo].BeginEdit();
dt = dt .Rows[rowNo][columnName] = strgCellFill;
dt = dt .Rows[rowNo].EndEdit();

string s = dt.Rows[rowNo][columnName]; // s = strgCellFill

DataRow dr = dt.Rows[rowNo];
string s1 = dr.RowState.ToS tring(); // s1 = "Modified"

DS dataSetChanges = getDataSetChang es();

if (dataSetChanges .HasChanges())
{
this.Conn.Open( );
this.da.Update( ds); //throws an exception
this.Conn.Close ();
}

Nov 16 '05 #4
> It's a System.Data.Ole Db.OleDbExcepti on.

Ok, but you need to catch nd display the complete error of th exception ;)

Bye

-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9
"Steve B." wrote:
It's a System.Data.Ole Db.OleDbExcepti on.

Looks like the database. Wouldn't the Open() fail if it was a problem with
the dB?

Should I recreate the Conn, DA and DS

Steve

"Steve B." wrote:
Does anyone know why the DA Update() would throw an exception?

I moved the database but I updated the Conn and the DA, currently
(trying)removin g/replacing DS. Is there a another direction I should be
looking in? Does it matter if I move columns in the grid (everything is a
string anyways)? Does the DS need to be udated from the DT?
***************
int rowNo = dg.CurrentRowIn dex;

dt = dt .Rows[rowNo].BeginEdit();
dt = dt .Rows[rowNo][columnName] = strgCellFill;
dt = dt .Rows[rowNo].EndEdit();

string s = dt.Rows[rowNo][columnName]; // s = strgCellFill

DataRow dr = dt.Rows[rowNo];
string s1 = dr.RowState.ToS tring(); // s1 = "Modified"

DS dataSetChanges = getDataSetChang es();

if (dataSetChanges .HasChanges())
{
this.Conn.Open( );
this.da.Update( ds); //throws an exception
this.Conn.Close ();
}

Nov 16 '05 #5
I'm studing this don't know what to do yet, creates duplicate key??
Steve

Message1 ---
The changes you requested to the table were not successful because they
would create duplicate values in the index, primary key, or relationship.
Change the data in the field or fields that contain duplicate data, remove
the index, or redefine the index to permit duplicate entries and try again.

String Message ---
System.Data.Ole Db.OleDbExcepti on: The changes you requested to the table
were not successful because they would create duplicate values in the index,
primary key, or relationship. Change the data in the field or fields that
contain duplicate data, remove the index, or redefine the index to permit
duplicate entries and try again.
at System.Data.Com mon.DbDataAdapt er.Update(DataR ow[] dataRows,
DataTableMappin g tableMapping)
at System.Data.Com mon.DbDataAdapt er.Update(DataS et dataSet, String
srcTable)
at businessInforma tion.ConfigMgmt Log.UpdateDataB ase() in
c:\businessinfo rmationsoftware \businessinform ation\configmgm tlog.cs:line 2028

HelpLink ---
Source ---
Microsoft JET Database Engine

StackTrace ---
at System.Data.Com mon.DbDataAdapt er.Update(DataR ow[] dataRows,
DataTableMappin g tableMapping)
at System.Data.Com mon.DbDataAdapt er.Update(DataS et dataSet, String
srcTable)
at businessInforma tion.ConfigMgmt Log.UpdateDataB ase() in
c:\businessinfo rmationsoftware \businessinform ation\configmgm tlog.cs:line 2028

TargetSite ---
Int32 Update(System.D ata.DataRow[], System.Data.Com mon.DataTableMa pping)
Inner Exception ---

The program '[1992] businessInforma tion.exe' has exited with code 0 (0x0).

"LEBRUN Thomas" wrote:
It's a System.Data.Ole Db.OleDbExcepti on.


Ok, but you need to catch nd display the complete error of th exception ;)

Bye

-------------------
LEBRUN Thomas
http://morpheus.developpez.com
http://blog.developpez.com/index.php?blog=9
"Steve B." wrote:
It's a System.Data.Ole Db.OleDbExcepti on.

Looks like the database. Wouldn't the Open() fail if it was a problem with
the dB?

Should I recreate the Conn, DA and DS

Steve

"Steve B." wrote:
Does anyone know why the DA Update() would throw an exception?

I moved the database but I updated the Conn and the DA, currently
(trying)removin g/replacing DS. Is there a another direction I should be
looking in? Does it matter if I move columns in the grid (everything is a
string anyways)? Does the DS need to be udated from the DT?
***************
int rowNo = dg.CurrentRowIn dex;

dt = dt .Rows[rowNo].BeginEdit();
dt = dt .Rows[rowNo][columnName] = strgCellFill;
dt = dt .Rows[rowNo].EndEdit();

string s = dt.Rows[rowNo][columnName]; // s = strgCellFill

DataRow dr = dt.Rows[rowNo];
string s1 = dr.RowState.ToS tring(); // s1 = "Modified"

DS dataSetChanges = getDataSetChang es();

if (dataSetChanges .HasChanges())
{
this.Conn.Open( );
this.da.Update( ds); //throws an exception
this.Conn.Close ();
}

Nov 16 '05 #6
Steve... It sounds like your update would result in a condition not
allowed by
the database such as a row with a duplicate primary key.

Regards,
Jeff
System.Data.Ol eDb.OleDbExcept ion: The changes you requested to the

table were not successful because they would create duplicate values in
the
index, primary key, or relationship.<

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #7
Thanks. I use a DG and bound CB/TB adjacent to the DG to update the
DG/DS/DB. Right now, for testing purposes, instead of updating all 10 fields
of the DG/DS/DB I'm just updating one field for now and update() no longer
crashes, but that presents another problem:

That one test field (worst case) is a CB and making CB selection
(CB.selectedind ex > 0) is'nt saved to the DB even though the CB selection is
collected properly and sent to updated(). If I manually type an entry at
CB.selectedinde x = 0 the selection is saved to DB but then the field doesn't
update if I change the DG pointer (i.e. keeps the typed valve). I can use
CB.selectedinde x = -1, then fill() again, etc, but not sure if that's the
direction. Cause for a new ADO thread

"Jeff Louie" wrote:
Steve... It sounds like your update would result in a condition not
allowed by
the database such as a row with a duplicate primary key.

Regards,
Jeff
System.Data.Ol eDb.OleDbExcept ion: The changes you requested to the

table were not successful because they would create duplicate values in
the
index, primary key, or relationship.<

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #8

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

Similar topics

2
4277
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third underline. It was working fine before. ConnectionString in Web.config: ----------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <configuration>
6
1580
by: Geoff Pennington | last post by:
I have a class method that returns a DataAdapter. I want to access the table(s) contained in the DataAdapter. Of course, accessing the DataSets would be good enough, because I could get the tables from there. I can't find a way to do this. Am I missing something? Much obliged.
13
2094
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an OleDbCommand with an SQL String and the connection it has a DataAdapter with the command then it fills the DataSet's DataTable with the streamed data.
2
2123
by: johnb41 | last post by:
I have a very simple application where i just want to display records from a database, and be able to edit the records. Here's the code for the "update" button: Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click DA.Update(DataSet, "mytable") End Sub
11
2255
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to reflect that the 3 items have been deleted only to discover that the 3 items appear, however when I click on them to display their information which runs a datareader over the same database it appears that the data has now gone. I wondered whether...
8
2700
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. Example: I have a dataadapter that contains one table with one row. I change the value of the 'FisrtName' column in that row from Jack to John. I call ..update on the dataadapter it goes through fine. Now I change that same column in that same row...
1
1434
by: Franklin M. Gauer III | last post by:
I create a simple DATAADAPTER in a webservice project. It creates the UPDATE, INSERT, DELETE commands for me - no problem. In vS2005 it creates these commands as RESOURCES in the RESX file (i.e. strings). The problem is whenever I try to test the webservice I get: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure...
2
1895
by: Franklin M. Gauer III | last post by:
I create a simple DATAADAPTER in a webservice project. It creates the UPDATE, INSERT, DELETE commands for me - no problem. In vS2005 it creates these commands as RESOURCES in the RESX file (i.e. strings). The problem is whenever I try to test the webservice I get: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure...
6
14005
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection = conn da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1" da.Update(tblx) '--tblx/tbl1 not getting updated here.
5
5048
by: George | last post by:
I have set DataAdapter.AcceptChangesDuringUpdate = true; However, I find that I still need to call AcceptChanges on the associated DataTable, DataTable.AcceptChanges(); Has anyone encountered that? Am I not setting this field properly? The following are some of the snippets of the codes which may help explain
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10569
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
10325
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...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
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...
1
7615
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5519
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...
1
4295
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
2990
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.