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.OleDb.OleDbException: 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.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at businessInformation.ConfigMgmtLog.UpdateDataBase() in
c:\businessinformationsoftware\businessinformation \configmgmtlog.cs:line 2028
HelpLink ---
Source ---
Microsoft JET Database Engine
StackTrace ---
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at businessInformation.ConfigMgmtLog.UpdateDataBase() in
c:\businessinformationsoftware\businessinformation \configmgmtlog.cs:line 2028
TargetSite ---
Int32 Update(System.Data.DataRow[], System.Data.Common.DataTableMapping)
Inner Exception ---
The program '[1992] businessInformation.exe' has exited with code 0 (0x0).
"LEBRUN Thomas" wrote:
It's a System.Data.OleDb.OleDbException.
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.OleDb.OleDbException.
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)removing/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.CurrentRowIndex;
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.ToString(); // s1 = "Modified"
DS dataSetChanges = getDataSetChanges();
if (dataSetChanges.HasChanges())
{
this.Conn.Open();
this.da.Update(ds); //throws an exception
this.Conn.Close();
}