Click here to Skip to main content
16,005,437 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Programmatically "corrupt" an mp3 file Pin
Vasudevan Deepak Kumar5-Jan-07 22:41
Vasudevan Deepak Kumar5-Jan-07 22:41 
QuestionSample for change column order by mouse in DataGrid Pin
AndrusM1-Jan-07 1:09
AndrusM1-Jan-07 1:09 
AnswerRe: Sample for change column order by mouse in DataGrid Pin
Robert Rohde3-Jan-07 1:14
Robert Rohde3-Jan-07 1:14 
GeneralRe: Sample for change column order by mouse in DataGrid Pin
AndrusM3-Jan-07 7:18
AndrusM3-Jan-07 7:18 
QuestionHow to activate first column after adding row to DataGrid Pin
AndrusM1-Jan-07 1:07
AndrusM1-Jan-07 1:07 
QuestionCtrl+S is DataGrid does not save data Pin
AndrusM1-Jan-07 1:04
AndrusM1-Jan-07 1:04 
AnswerRe: Ctrl+S is DataGrid does not save data Pin
Christian Graus1-Jan-07 18:25
protectorChristian Graus1-Jan-07 18:25 
GeneralRe: Ctrl+S is DataGrid does not save data Pin
AndrusM2-Jan-07 8:51
AndrusM2-Jan-07 8:51 
I have DataTable bound to DataGrid and Datamember is not set. I checked

((DataTable)DataSource).Rows[this.CurrentCell.RowNumber][this.CurrentCell.ColumnNumber]

in immediate window and this value changes properly: after Ctrl+S it shows new value.

However Update() method return 0 for unknown reason.
If I move to new row and press Ctrl+S, Update() returs 1 as expected.

I use the following method to save data. Any idea how to make Ctrl+S to work.

public static int Save(DataSet ds, string tableName,
		string primaryKeyName, bool retrieveAutoIncrementPK,
							IDbDataAdapter dbAdapter)
		{
			DataSet changes = ds.GetChanges();
			NpgsqlTransaction transact = Connection.BeginTransaction();
			int RowsUpdated = 0;
			if (changes != null)
			{
				if (retrieveAutoIncrementPK)
					((NpgsqlDataAdapter)dbAdapter).RowUpdated +=
						delegate(object sender, NpgsqlRowUpdatedEventArgs args)
						{
							if (args.StatementType == StatementType.Insert)
							{
								if (args.Row[primaryKeyName].ToString() == "")
									args.Row[primaryKeyName] = SequenceCurrentValue(
										args.Row.Table.TableName, primaryKeyName);
							}
						};

				try
				{
					RowsUpdated = dbAdapter.Update(changes);
				}
				catch (NpgsqlException e)
				{
					transact.Rollback();
					throw e;
				}
			}

			transact.Commit();
			if (changes != null)
				ds.Merge(changes, false, MissingSchemaAction.Error);

			ds.AcceptChanges();
			foreach (DataRow dr in ds.Tables[tableName].Rows)
				if (dr[dr.Table.PrimaryKey[0].ColumnName].GetType() ==
						typeof(System.DBNull))
					dr.Delete();

			ds.AcceptChanges();

			return RowsUpdated;
		}



Andrus

QuestionRetriecing the Original Width & Height from Compressed Image [modified] Pin
*Mehraj29-Dec-06 21:38
*Mehraj29-Dec-06 21:38 
QuestionAlternate control for DSO Framer in .net [modified] Pin
indian14329-Dec-06 18:52
indian14329-Dec-06 18:52 
QuestionConvert DataGridView to HTMLTable? Pin
PhrankBooth29-Dec-06 3:16
PhrankBooth29-Dec-06 3:16 
AnswerRe: Convert DataGridView to HTMLTable? Pin
JoeRip1-Jan-07 17:31
JoeRip1-Jan-07 17:31 
GeneralRe: Convert DataGridView to HTMLTable? Pin
PhrankBooth2-Jan-07 2:08
PhrankBooth2-Jan-07 2:08 
QuestionCan I run vb or com components Pin
indian14329-Dec-06 2:00
indian14329-Dec-06 2:00 
AnswerRe: Can I run vb or com components Pin
Paul Conrad29-Dec-06 5:36
professionalPaul Conrad29-Dec-06 5:36 
GeneralRe: Can I run vb or com components Pin
indian14329-Dec-06 18:47
indian14329-Dec-06 18:47 
GeneralRe: Can I run vb or com components Pin
Paul Conrad29-Dec-06 19:01
professionalPaul Conrad29-Dec-06 19:01 
QuestionXML and DBMS Pin
Tauseef A29-Dec-06 1:29
Tauseef A29-Dec-06 1:29 
AnswerRe: XML and DBMS Pin
Pete O'Hanlon2-Jan-07 4:04
mvePete O'Hanlon2-Jan-07 4:04 
QuestionHow to: delete class from compiled in memory assembly? Pin
netvano29-Dec-06 1:13
netvano29-Dec-06 1:13 
AnswerRe: How to: delete class from compiled in memory assembly? Pin
Luc Pattyn29-Dec-06 14:00
sitebuilderLuc Pattyn29-Dec-06 14:00 
GeneralRe: How to: delete class from compiled in memory assembly? Pin
netvano1-Jan-07 21:04
netvano1-Jan-07 21:04 
QuestionProble To install VS.NET 2.0 Pin
Imran Khan Pathan28-Dec-06 21:24
Imran Khan Pathan28-Dec-06 21:24 
QuestionHow can I take the backup of SQL server database through coding Pin
indian14328-Dec-06 19:53
indian14328-Dec-06 19:53 
QuestionDistributed object cache for Enterprise Library 2.0 Pin
Iqbal M Khan28-Dec-06 19:40
Iqbal M Khan28-Dec-06 19:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.