473,581 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

friggin dataset is not showing delete changes

Hello,

How come when I add a new row to my dataset table it shows up as changed
(agencyData.Has changes() = True) but when I delete a row the dataset thinks
here are no changes(agencyD ata.Haschanges( ) = False)????

The bizaar thing is the row count before the delete and after is different
so it definately is being deleted but I cannot update my main database table
because the dataset thinks there are no changes?
Heres my code:

--------------------------------
agencyDatabaseD ataset.Predeces sorRow rowToDelete =
(agencyDatabase Dataset.Predece ssorRow)agencyD ata.Predecessor .Select("succes sor="
+ agency.ID + " AND predecessor=" + currAgencyId)[0];

agencyData.Pred ecessor.RemoveP redecessorRow(r owToDelete);
-----------------------------
Thanks for any help,
Grant
Nov 16 '05 #1
5 1821
Grant <gp*****@hotmai l.com> wrote:
How come when I add a new row to my dataset table it shows up as changed
(agencyData.Has changes() = True) but when I delete a row the dataset thinks
here are no changes(agencyD ata.Haschanges( ) = False)????

The bizaar thing is the row count before the delete and after is different
so it definately is being deleted but I cannot update my main database table
because the dataset thinks there are no changes?


If you add a row but then delete it before it gets written to the
database, there *are* no changes. Or are you deleting a different row?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Ive got an access table containing 2 columns
column 1 name = successor (int)
column 2 name = predecessor (int)\

Got oleDbConnection 1 to connect to the database.
Got 2 OleDbDataAdapte rs for the two tables ( one of the tables is not
referenced at all its just there ).
1 typed dataset

Got a form with a single button. Whern i break at the messagebox, counthis
=6 and counthis2=5 so a row has been deleted but the 'dataSet.HasCha nges() '
still show false.
Heres the code:

form initialise:
------------------------------------
agencyAdapter.F ill(dataSet);
predecessorAdap ter.Fill(dataSe t);
------------------------------------

Button click event:
------------------------------------
int counthis = dataSet.Predece ssor.Rows.Count ;
DataSet1.Predec essorRow rowtodelete = (DataSet1.Prede cessorRow)
dataSet.Predece ssor.Select("su ccessor=" + 1633 + " AND predecessor=" +
2)[0];
dataSet.Predece ssor.RemovePred ecessorRow(rowt odelete);
int counthis2 = dataSet.Predece ssor.Rows.Count ;
MessageBox.Show ("sdsdfsdfs" ); //used for breakpoint
------------------------------------


"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Grant <gp*****@hotmai l.com> wrote:
How come when I add a new row to my dataset table it shows up as changed
(agencyData.Has changes() = True) but when I delete a row the dataset
thinks
here are no changes(agencyD ata.Haschanges( ) = False)????

The bizaar thing is the row count before the delete and after is
different
so it definately is being deleted but I cannot update my main database
table
because the dataset thinks there are no changes?


If you add a row but then delete it before it gets written to the
database, there *are* no changes. Or are you deleting a different row?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3
Grant <gp*****@hotmai l.com> wrote:

<snip>
Heres the code:


<snip>

That's not the code. That's a couple of snippets of code. In
particular, it's nothing I can compile and run.

Please read http://www.pobox.com/~skeet/csharp/complete.html again

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
Is this what youre after?
----------------------------------------------------
using System;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;

namespace WindowsApplicat ion3
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows. Forms.Form
{
private System.Windows. Forms.Button button1;
private System.Data.Ole Db.OleDbConnect ion oleDbConnection 1;
private System.Data.Ole Db.OleDbDataAda pter agencyAdapter;
private System.Data.Ole Db.OleDbCommand oleDbSelectComm and1;
private System.Data.Ole Db.OleDbCommand oleDbInsertComm and1;
private System.Data.Ole Db.OleDbDataAda pter predecessorAdap ter;
private System.Data.Ole Db.OleDbCommand oleDbSelectComm and2;
private System.Data.Ole Db.OleDbCommand oleDbInsertComm and2;
private WindowsApplicat ion3.DataSet1 dataSet;
private System.Data.Ole Db.OleDbCommand oleDbCommand1;
private System.Data.Ole Db.OleDbCommand oleDbCommand2;
private System.Data.Ole Db.OleDbCommand oleDbCommand3;
private System.Windows. Forms.Button button2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();

agencyAdapter.F ill(dataSet);
predecessorAdap ter.Fill(dataSe t);

//
// TODO: Add any constructor code after InitializeCompo nent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.button1 = new System.Windows. Forms.Button();
this.oleDbConne ction1 = new System.Data.Ole Db.OleDbConnect ion();
this.agencyAdap ter = new System.Data.Ole Db.OleDbDataAda pter();
this.oleDbInser tCommand1 = new System.Data.Ole Db.OleDbCommand ();
this.oleDbSelec tCommand1 = new System.Data.Ole Db.OleDbCommand ();
this.dataSet = new WindowsApplicat ion3.DataSet1() ;
this.predecesso rAdapter = new System.Data.Ole Db.OleDbDataAda pter();
this.oleDbInser tCommand2 = new System.Data.Ole Db.OleDbCommand ();
this.oleDbSelec tCommand2 = new System.Data.Ole Db.OleDbCommand ();
this.oleDbComma nd1 = new System.Data.Ole Db.OleDbCommand ();
this.oleDbComma nd2 = new System.Data.Ole Db.OleDbCommand ();
this.oleDbComma nd3 = new System.Data.Ole Db.OleDbCommand ();
this.button2 = new System.Windows. Forms.Button();
((System.Compon entModel.ISuppo rtInitialize)(t his.dataSet)).B eginInit();
this.SuspendLay out();
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(64, 224);
this.button1.Na me = "button1";
this.button1.Ta bIndex = 0;
this.button1.Te xt = "button1";
this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);
//
// oleDbConnection 1
//
this.oleDbConne ction1.Connecti onString = @"Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet
OLEDB:Database Password=;Data Source=""C:\Pro gram
Files\SoftLaw\D atabases\Agency Database.mdb""; Password=;Jet OLEDB:Engine
Type=5;Jet OLEDB:Global Bulk
Transactions=1; Provider=""Micr osoft.Jet.OLEDB .4.0"";Jet OLEDB:System
database=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny None;Jet
OLEDB:New Database Password=;Jet OLEDB:Create System Database=False; Jet
OLEDB:Don't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica
Repair=False;Us er ID=Admin;Jet OLEDB:Encrypt Database=False" ;
//
// agencyAdapter
//
this.agencyAdap ter.InsertComma nd = this.oleDbInser tCommand1;
this.agencyAdap ter.SelectComma nd = this.oleDbSelec tCommand1;
this.agencyAdap ter.TableMappin gs.AddRange(new
System.Data.Com mon.DataTableMa pping[] {

new System.Data.Com mon.DataTableMa pping("Table", "Agency",
new System.Data.Com mon.DataColumnM apping[] {
new
System.Data.Com mon.DataColumnM apping("budgetS tatus", "budgetStatus") ,
new
System.Data.Com mon.DataColumnM apping("cessati onDate", "cessationDate" ),
new
System.Data.Com mon.DataColumnM apping("cessati onDateSource",
"cessationDateS ource"),
new
System.Data.Com mon.DataColumnM apping("cessati onInstrument",
"cessationInstr ument"),
new
System.Data.Com mon.DataColumnM apping("comment s", "comments") ,
new
System.Data.Com mon.DataColumnM apping("creatio nDate", "creationDate") ,
new
System.Data.Com mon.DataColumnM apping("creatio nDateSource",
"creationDateSo urce"),
new
System.Data.Com mon.DataColumnM apping("creatio nInstrument",
"creationInstru ment"),
new
System.Data.Com mon.DataColumnM apping("Current Agency", "CurrentAgency" ),
new
System.Data.Com mon.DataColumnM apping("id", "id"),
new
System.Data.Com mon.DataColumnM apping("name", "name"),
new
System.Data.Com mon.DataColumnM apping("reasonF orNonRecognitio n",
"reasonForNonRe cognition"),
new
System.Data.Com mon.DataColumnM apping("schedul eType", "scheduleType") ,
new
System.Data.Com mon.DataColumnM apping("Schedul eTypeSource",
"ScheduleTypeSo urce"),
new
System.Data.Com mon.DataColumnM apping("state", "state"),
new
System.Data.Com mon.DataColumnM apping("statusC hange", "statusChange") ,
new
System.Data.Com mon.DataColumnM apping("UniqueI D", "UniqueID")})}) ;
this.agencyAdap ter.UpdateComma nd = this.oleDbComma nd3;
//
// oleDbInsertComm and1
//
this.oleDbInser tCommand1.Comma ndText = @"INSERT INTO
Agency(budgetSt atus, cessationDate, cessationDateSo urce,
cessationInstru ment, comments, creationDate, creationDateSou rce,
creationInstrum ent, CurrentAgency, id, name, reasonForNonRec ognition,
scheduleType, ScheduleTypeSou rce, state, statusChange, UniqueID) VALUES (?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
this.oleDbInser tCommand1.Conne ction = this.oleDbConne ction1;
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("budgetStatu s",
System.Data.Ole Db.OleDbType.In teger, 0, "budgetStatus") );
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("cessationDa te",
System.Data.Ole Db.OleDbType.DB Date, 0, "cessationDate" ));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("cessationDa teSource",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "cessationDateS ource"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("cessationIn strument",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "cessationInstr ument"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("comments",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "comments") );
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("creationDat e",
System.Data.Ole Db.OleDbType.DB Date, 0, "creationDate") );
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("creationDat eSource",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "creationDateSo urce"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("creationIns trument",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "creationInstru ment"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("CurrentAgen cy",
System.Data.Ole Db.OleDbType.Va rWChar, 50, "CurrentAgency" ));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("id", System.Data.Ole Db.OleDbType.In teger,
0, "id"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("name",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "name"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("reasonForNo nRecognition",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "reasonForNonRe cognition"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("scheduleTyp e",
System.Data.Ole Db.OleDbType.In teger, 0, "scheduleType") );
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("ScheduleTyp eSource",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "ScheduleTypeSo urce"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("state",
System.Data.Ole Db.OleDbType.In teger, 0, "state"));
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("statusChang e",
System.Data.Ole Db.OleDbType.Va rWChar, 5, "statusChange") );
this.oleDbInser tCommand1.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("UniqueID",
System.Data.Ole Db.OleDbType.Sm allInt, 0, "UniqueID") );
//
// oleDbSelectComm and1
//
this.oleDbSelec tCommand1.Comma ndText = @"SELECT budgetStatus,
cessationDate, cessationDateSo urce, cessationInstru ment, comments,
creationDate, creationDateSou rce, creationInstrum ent, CurrentAgency, id,
name, reasonForNonRec ognition, scheduleType, ScheduleTypeSou rce, state,
statusChange, UniqueID FROM Agency";
this.oleDbSelec tCommand1.Conne ction = this.oleDbConne ction1;
//
// dataSet
//
this.dataSet.Da taSetName = "DataSet1";
this.dataSet.Lo cale = new System.Globaliz ation.CultureIn fo("en-AU");
//
// predecessorAdap ter
//
this.predecesso rAdapter.Delete Command = this.oleDbComma nd2;
this.predecesso rAdapter.Insert Command = this.oleDbInser tCommand2;
this.predecesso rAdapter.Select Command = this.oleDbSelec tCommand2;
this.predecesso rAdapter.TableM appings.AddRang e(new
System.Data.Com mon.DataTableMa pping[] {

new System.Data.Com mon.DataTableMa pping("Table",
"Predecesso r", new System.Data.Com mon.DataColumnM apping[] {
new
System.Data.Com mon.DataColumnM apping("comment s", "comments") ,
new
System.Data.Com mon.DataColumnM apping("predece ssor", "predecesso r"),
new
System.Data.Com mon.DataColumnM apping("success or", "successor")})} );
this.predecesso rAdapter.Update Command = this.oleDbComma nd1;
//
// oleDbInsertComm and2
//
this.oleDbInser tCommand2.Comma ndText = "INSERT INTO
Predecessor(com ments, predecessor, successor) VALUES (?, ?, ?)";
this.oleDbInser tCommand2.Conne ction = this.oleDbConne ction1;
this.oleDbInser tCommand2.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("comments",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "comments") );
this.oleDbInser tCommand2.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("predecessor ",
System.Data.Ole Db.OleDbType.In teger, 0, "predecessor")) ;
this.oleDbInser tCommand2.Param eters.Add(new
System.Data.Ole Db.OleDbParamet er("successor" ,
System.Data.Ole Db.OleDbType.In teger, 0, "successor" ));
//
// oleDbSelectComm and2
//
this.oleDbSelec tCommand2.Comma ndText = "SELECT comments, predecessor,
successor FROM Predecessor";
this.oleDbSelec tCommand2.Conne ction = this.oleDbConne ction1;
//
// oleDbCommand1
//
this.oleDbComma nd1.CommandText = "UPDATE Predecessor SET comments = ?,
predecessor = ?, successor = ? WHERE (predec" +
"essor = ?) AND (successor = ?)";
this.oleDbComma nd1.Connection = this.oleDbConne ction1;
this.oleDbComma nd1.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("comments",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "comments") );
this.oleDbComma nd1.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("predecessor ",
System.Data.Ole Db.OleDbType.In teger, 0, "predecessor")) ;
this.oleDbComma nd1.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("successor" ,
System.Data.Ole Db.OleDbType.In teger, 0, "successor" ));
this.oleDbComma nd1.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("Original_pr edecessor",
System.Data.Ole Db.OleDbType.In teger, 0,
System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)),
((System.Byte)( 0)), "predecesso r", System.Data.Dat aRowVersion.Ori ginal,
null));
this.oleDbComma nd1.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("Original_su ccessor",
System.Data.Ole Db.OleDbType.In teger, 0,
System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)),
((System.Byte)( 0)), "successor" , System.Data.Dat aRowVersion.Ori ginal,
null));
//
// oleDbCommand2
//
this.oleDbComma nd2.CommandText = "DELETE FROM Predecessor WHERE
(predecessor = ? AND successor = ?)";
this.oleDbComma nd2.Connection = this.oleDbConne ction1;
this.oleDbComma nd2.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("predecessor ",
System.Data.Ole Db.OleDbType.In teger, 0,
System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)),
((System.Byte)( 0)), "predecesso r", System.Data.Dat aRowVersion.Ori ginal,
null));
this.oleDbComma nd2.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("successor" ,
System.Data.Ole Db.OleDbType.In teger, 0,
System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)),
((System.Byte)( 0)), "successor" , System.Data.Dat aRowVersion.Ori ginal,
null));
//
// oleDbCommand3
//
this.oleDbComma nd3.CommandText = @"UPDATE Agency SET budgetStatus = ?,
cessationDate = ?, cessationInstru ment = ?, cessationDateSo urce = ?,
comments = ?, creationDate = ?, creationDateSou rce = ?, creationInstrum ent =
?, name = ?, reasonForNonRec ognition = ?, scheduleType = ?,
ScheduleTypeSou rce = ?, state = ?, statusChange = ? WHERE (id = ?)";
this.oleDbComma nd3.Connection = this.oleDbConne ction1;
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("budgetStatu s",
System.Data.Ole Db.OleDbType.In teger, 0, "budgetStatus") );
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("cessationDa te",
System.Data.Ole Db.OleDbType.DB Date, 0, "cessationDate" ));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("cessationIn strument",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "cessationInstr ument"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("cessationDa teSource",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "cessationDateS ource"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("comments",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "comments") );
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("creationDat e",
System.Data.Ole Db.OleDbType.DB Date, 0, "creationDate") );
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("creationDat eSource",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "creationDateSo urce"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("creationIns trument",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "creationInstru ment"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("name",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "name"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("reasonForNo nRecognition",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "reasonForNonRe cognition"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("scheduleTyp e",
System.Data.Ole Db.OleDbType.In teger, 0, "scheduleType") );
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("ScheduleTyp eSource",
System.Data.Ole Db.OleDbType.Va rWChar, 255, "ScheduleTypeSo urce"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("state",
System.Data.Ole Db.OleDbType.In teger, 0, "state"));
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("statusChang e",
System.Data.Ole Db.OleDbType.Va rWChar, 5, "statusChange") );
this.oleDbComma nd3.Parameters. Add(new
System.Data.Ole Db.OleDbParamet er("Original_id ",
System.Data.Ole Db.OleDbType.In teger, 0,
System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)),
((System.Byte)( 0)), "id", System.Data.Dat aRowVersion.Ori ginal, null));
//
// button2
//
this.button2.Lo cation = new System.Drawing. Point(200, 232);
this.button2.Na me = "button2";
this.button2.Ta bIndex = 1;
this.button2.Te xt = "button2";
this.button2.Cl ick += new System.EventHan dler(this.butto n2_Click);
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(292, 273);
this.Controls.A dd(this.button2 );
this.Controls.A dd(this.button1 );
this.Name = "Form1";
this.Text = "Form1";
((System.Compon entModel.ISuppo rtInitialize)(t his.dataSet)).E ndInit();
this.ResumeLayo ut(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}

private void button1_Click(o bject sender, System.EventArg s e)
{
int counthis = dataSet.Predece ssor.Rows.Count ;
DataSet1.Predec essorRow rowtodelete = (DataSet1.Prede cessorRow)
dataSet.Predece ssor.Select("su ccessor=" + 2 + " AND predecessor=" + 1)[0];
dataSet.Predece ssor.RemovePred ecessorRow(rowt odelete);
int counthis2 = dataSet.Predece ssor.Rows.Count ;
MessageBox.Show ("sdsdfsdfs" );
updatethisShit( );

}

private void button2_Click(o bject sender, System.EventArg s e)
{
DataSet1.Predec essorRow rowtoadd =
dataSet.Predece ssor.NewPredece ssorRow();
rowtoadd.predec essor = 1;
rowtoadd.succes sor = 2;
dataSet.Predece ssor.Rows.Add(r owtoadd);
MessageBox.Show ("sdsdfsdfs" );

updatethisShit( );

}

private void updatethisShit( )
{
predecessorAdap ter.Update(data Set);
}
}
}
----------------------------------------------------
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Grant <gp*****@hotmai l.com> wrote:

<snip>
Heres the code:


<snip>

That's not the code. That's a couple of snippets of code. In
particular, it's nothing I can compile and run.

Please read http://www.pobox.com/~skeet/csharp/complete.html again

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #5
Grant <gp*****@hotmai l.com> wrote:
Is this what youre after?


Not quite - I still can't compile it, because you didn't include
DataSet1.

If you definitely need the database itself for this, it's probably
worth just mailing me a zip file of the project including a sample
database.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6

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

Similar topics

2
1305
by: Roy | last post by:
Hi all, I've filled a dataset from a select dataadapter. Dataset has been modified and I need to send changes back to the database. Since dataadapter has been disposed, what is the code to send these changes to the database. Thanks, Roy
0
1966
by: Frosty | last post by:
Hi I am using the VS xsd designer to create a strongly typed dataset. The dataset is apparently successfully created, with no warnings or errors given. Is it not then to be expected that this dataset then should reflect all the details put into the xsd? Somewhere down the line there is not a 1:1 relationship. Be it that .NET is so tightly...
2
5499
by: Kenny | last post by:
Hello all, I've made a dataset by using the xsd tool in C#. In the xsd schema, there are a few tables, each has its own primary key. And, I've made relation between them. After all things are done, I can use the dataset class generated to retrieve data. The problem is that, when I try to delete a parent row (using RemoveTABLERow method),...
1
2916
by: Henry | last post by:
Hi. I've been trying to modify my dataset and have been unsucessful. Any help would be great. What I have is a dataset in a session variable. Here is what I have done to stored into the dataset via store procedure. Sample Stored Procedure: CREATE PROCEDURE prcGetData AS
6
1306
by: al | last post by:
Greetings, Thanks in advance for your kind attension. I have been searching for documents about dynamically coding MDI forms when working with datasets. Does anyone know of any??? MTIA, Grawsha
2
6892
by: John Granade | last post by:
I'm looking for the best way to make a dataset available from multiple Windows forms. The dataset is created from an XML file. I have a main form (frmMain) that loads the dataset and reads the data but then I have other forms that give the ability to add, modify, and delete rows. This of course changes the dataset and I need that reflected...
4
2241
by: Al | last post by:
I have this scenario: 1. XML file with schema and data is created from SQL Server tables. XML file contains 6 tables, some of them have rows, some of them are empty. 2. XML file is given to the person with Pocket PC. 3. XML file is used to populate DataSet on the Pocket PC. 4. User adds new rows, changes values, deletes some rows. 5. Altered...
8
3265
by: David | last post by:
Hi all, Using C# 1.1 I have a dataset loaded from an XML file. The idea being that if the app (a winform app that relies on a webservice) is offline, then I save data locally in XML and update the web service later. So, when I update, I have something like...
1
1776
by: Neil Chambers | last post by:
This is more likely a question for an SQL group but as I'm using powershell and dotnet it may be relevant Overview: I'm trying to pull data from Excel into a DataSet - modifying the DataSet - then updating the excel source I have got to the point where I think I need Update and Delete Command strings for the DataAdapter but I'm at a loss...
0
7862
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...
0
7789
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...
0
8144
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. ...
1
7894
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...
0
6551
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...
1
5670
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...
1
2300
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
1
1400
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1132
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...

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.