Click here to Skip to main content
15,918,742 members
Home / Discussions / Database
   

Database

 
GeneralRe: backing up/moving mssql databases Pin
Mike Dimmick6-Oct-03 23:20
Mike Dimmick6-Oct-03 23:20 
GeneralRe: backing up/moving mssql databases Pin
djkno37-Oct-03 4:18
djkno37-Oct-03 4:18 
GeneralRe: backing up/moving mssql databases Pin
Mike Dimmick7-Oct-03 22:39
Mike Dimmick7-Oct-03 22:39 
GeneralSqlDataAdapter.Update sometimes does not update Pin
james-cxx2-Oct-03 10:55
james-cxx2-Oct-03 10:55 
GeneralRe: SqlDataAdapter.Update sometimes does not update Pin
james-cxx14-Oct-03 18:18
james-cxx14-Oct-03 18:18 
GeneralLogic Pin
Anonymous2-Oct-03 3:58
Anonymous2-Oct-03 3:58 
GeneralRe: Logic Pin
Mike Dimmick2-Oct-03 12:14
Mike Dimmick2-Oct-03 12:14 
GeneralWeird problem while inserting a record Pin
2sky1-Oct-03 23:53
2sky1-Oct-03 23:53 
Hello,

I wonder if anyone can help me with this.

I try to insert a record in a DataTable, and everything works absolutely perfect. UNTIL I create a custom DataView object based on the table.

Here is a small sample, when you take the DataView myView = new DataView(table); line out of comment the record isn't at the correct position anymore.

Any help is much appreciated !!!!

DataTable	table = new DataTable("Table");<br />
<br />
			DataColumn colID = table.Columns.Add("ID", typeof(int));<br />
			DataColumn colName = table.Columns.Add("Name", typeof(String));<br />
<br />
			colID.AllowDBNull = false;<br />
<br />
			table.Rows.Add(new object[] {1, "Row 1"});<br />
			table.Rows.Add(new object[] {2, "Row 2"});<br />
			table.Rows.Add(new object[] {4, "Row 4"});<br />
<br />
			table.AcceptChanges();<br />
<br />
			//DataView	myView = new DataView(table);<br />
<br />
			foreach(DataRowView row in table.DefaultView)<br />
			{<br />
				Console.WriteLine(row["Name"]);<br />
			}<br />
<br />
			Console.WriteLine("-------------------------------------------------------");<br />
<br />
			DataRowView cindyView = table.DefaultView.AddNew();<br />
			cindyView["ID"] = 3;<br />
			cindyView["Name"] = "Row 3";<br />
			<br />
			Object[] ItemArray = cindyView.Row.ItemArray;<br />
			cindyView.CancelEdit();<br />
<br />
			DataRow cindy = table.NewRow();<br />
			cindy.ItemArray = ItemArray;<br />
			cindy.EndEdit();<br />
			table.Rows.InsertAt(cindy, 2);<br />
<br />
			table.DefaultView.RowStateFilter = DataViewRowState.None;<br />
			table.DefaultView.RowStateFilter = DataViewRowState.CurrentRows;<br />
<br />
			foreach(DataRowView row in table.DefaultView)<br />
			{<br />
				Console.WriteLine(row["Name"]);<br />
			}

GeneralRe: Weird problem while inserting a record Pin
Mike Dimmick2-Oct-03 3:26
Mike Dimmick2-Oct-03 3:26 
GeneralRe: Weird problem while inserting a record Pin
2sky2-Oct-03 3:35
2sky2-Oct-03 3:35 
Generalerror deleting record in datagrid Pin
Giovanni Bejarasco1-Oct-03 23:09
Giovanni Bejarasco1-Oct-03 23:09 
GeneralRe: error deleting record in datagrid Pin
Mike Dimmick2-Oct-03 12:18
Mike Dimmick2-Oct-03 12:18 
GeneralRe: error deleting record in datagrid Pin
Giovanni Bejarasco2-Oct-03 20:07
Giovanni Bejarasco2-Oct-03 20:07 
GeneralRe: error deleting record in datagrid Pin
Mike Dimmick2-Oct-03 22:30
Mike Dimmick2-Oct-03 22:30 
GeneralRe: error deleting record in datagrid Pin
Giovanni Bejarasco3-Oct-03 1:41
Giovanni Bejarasco3-Oct-03 1:41 
GeneralRe: error deleting record in datagrid Pin
Ian Darling3-Oct-03 22:16
Ian Darling3-Oct-03 22:16 
GeneralDatabases concurrecny issues Pin
Jahangir Jamshed1-Oct-03 19:26
sussJahangir Jamshed1-Oct-03 19:26 
GeneralRe: Databases concurrecny issues Pin
Andy Harman1-Oct-03 22:51
Andy Harman1-Oct-03 22:51 
GeneralRe: Databases concurrecny issues Pin
Mike Dimmick2-Oct-03 3:37
Mike Dimmick2-Oct-03 3:37 
GeneralRe: Databases concurrecny issues Pin
SimonS2-Oct-03 22:46
SimonS2-Oct-03 22:46 
GeneralDataRowState Problems Pin
Wjousts1-Oct-03 11:33
Wjousts1-Oct-03 11:33 
GeneralRe: DataRowState Problems Pin
Giovanni Bejarasco3-Oct-03 1:46
Giovanni Bejarasco3-Oct-03 1:46 
QuestionIndexing Problem??? Pin
Jason Weibel1-Oct-03 8:32
Jason Weibel1-Oct-03 8:32 
AnswerRe: Indexing Problem??? Pin
andyharman1-Oct-03 12:01
professionalandyharman1-Oct-03 12:01 
GeneralRe: Indexing Problem??? Pin
Jason Weibel2-Oct-03 12:09
Jason Weibel2-Oct-03 12:09 

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.