Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 6th, 2006, 03:45 PM
Registered User
 
Join Date: Apr 2006
Location: Pensacola, Fl, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Editing Data in a DataView

I'm a beginner programmer in C# asp.NET and am currently working on a web portal as a college project. My question is, how do you change data that's in a dataview?

I have a dataset, and a dataview pointing to that dataset. (I'm away from the code at the moment, so syntax might not be perfect)

Code:
dv.table = ds.TABLE;
dv.sort = "POSITION";
dv.rowviewfilter = "ID>=" + variable;


Then I try to assign it to stuff:

Code:
dv[0]["POSITION"] = 125;


or read things out:

Code:
variable = dv[0]["ID"];


Also, I write the changes to the database using my own SQL statements.

But it doesn't seem to work. It compiles fine, but the changes don't appear on the page or in the database.

I hope this makes sense. Thanks for your help!



  #2 (permalink)  
Old April 7th, 2006, 08:55 PM
Registered User
 
Join Date: Apr 2006
Location: Pensacola, Fl, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the exact code now. It's a function that swaps two locations.

Code:
int HighLocation, LowLocation;
ModuleDataView.Table = UserInfoDSInstance.USERMODULE;            
ModuleDataView.Sort = "UMPOSITION";
ModuleDataView.RowFilter = "MID=" + CallingModule;
HighLocation = (int)ModuleDataView[0]["UMPOSITION"];
ModuleDataView.Table = UserInfoDSInstance.USERMODULE;            
ModuleDataView.Sort = "UMPOSITION";
ModuleDataView.RowFilter = "UMPOSITION>=" + HighLocation;
LowLocation = (int)ModuleDataView[1]["UMPOSITION"];
ModuleDataView[0]["UMPOSITION"] = LowLocation;
ModuleDataView[1]["UMPOSITION"] = HighLocation;
oracleUpdateCommand1.CommandText = "UPDATE USERMODULE SET UMPOSITION = " + LowLocation + " WHERE MID = " + (int)ModuleDataView[0]["MID"] + " AND USERID = '" + UserID + "'";
OracleConnection.Open();
oracleUpdateCommand1.ExecuteScalar();
oracleUpdateCommand1.CommandText = "UPDATE USERMODULE SET UMPOSITION = " + HighLocation + " WHERE MID = " + (int)ModuleDataView[1]["MID"] + " AND USERID = '" + UserID + "'";
oracleUpdateCommand1.ExecuteScalar();
OracleConnection.Close();
The changes are not being written to the database. Not sure why...

  #3 (permalink)  
Old April 10th, 2006, 11:25 AM
Registered User
 
Join Date: Apr 2006
Location: Pensacola, Fl, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

anybody?? :(

  #4 (permalink)  
Old April 10th, 2006, 09:40 PM
Registered User
 
Join Date: Apr 2006
Location: Pensacola, Fl, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

nevermind...figured it out.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Binding - Editing GridView Row Data desk_star BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 7 December 30th, 2007 11:07 AM
Data Grid Editing in C# bmains C# 1 December 16th, 2004 04:23 AM
What is the code for editing data bisigreat VB How-To 2 August 19th, 2004 03:06 AM
Editing Access and import data edramail Access 2 May 7th, 2004 02:27 AM
Data Grid editing of class bmains Pro VB.NET 2002/2003 3 October 22nd, 2003 12:38 PM



All times are GMT -4. The time now is 08:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.