473,414 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Updating database with changes

hi!!

how am i supposed to update the db witht he changes the user make in webpage

am trying to make a simple page that have a grid bound to a table

the user can delete,add or update the grid

how do i get the changes into the database

after the page is loaded the dataset is gone so the databinding only works for reading

do i really have to make an array and handle the updating myself

regard
geir sann

Nov 18 '05 #1
2 1346
If you want to do updates, you should use a dataset. It sounds like you may
be using a datareader - if so, switch to a dataset.
To update using a dataset, make changes to the datatable during the update
event on the datagrid. Then, use the GetChanges method on the datatable to
construct a new table with the changes. Call the appropriate update method
for each changed row - insert, update, or delete.

"Geir Sanne" <an*******@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
hi!!!

how am i supposed to update the db witht he changes the user make in webpage ?
am trying to make a simple page that have a grid bound to a table.

the user can delete,add or update the grid.

how do i get the changes into the database ?

after the page is loaded the dataset is gone so the databinding only works for reading ?
do i really have to make an array and handle the updating myself ?

regards
geir sanne

Nov 18 '05 #2
Geir,

There are loads of examples on various specialist websites: www.123aspx.com
is a good place to bookmark.
I can tell you from my own experience I didn't want to use the default
asp.net methods of working with the datagrid, so I rolled my own after
learning from Microsoft and other examples.

Basically, I use stored procedures for all db read/write operations and do
all grid databinding in custom (VB) procedures.

So a page's code-behind might look something like:

Sub page_load (...) Handles ...
if Not page.ispostback then
'If required, ensure user is authenticated/authorised

'Get default data for display...
me.BindMyGrid()

end if

end sub
private sub BindMyGrid()
'Do the bind routine...
'Set up a connection to db and retrieve required data
'See my response posting for Tracey for example connection method:
'Re: Urgent: I can't update database with SqlCommand
' news:F4**********************************@microsof t.com
' news:ev**************@TK2MSFTNGP10.phx.gbl

end sub

private sub cmdSaveData(....) Handles ...
'Respond to the command button being clicked
'Validate all input
'I use try-catch statements for validation...
'Again, see the above message thread for my example technique for
validation and attaching values to send to the sproc/db
'
end sub

HTH
--
Alec MacLean
"Geir Sanne" <an*******@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
hi!!!

how am i supposed to update the db witht he changes the user make in webpage ?
am trying to make a simple page that have a grid bound to a table.

the user can delete,add or update the grid.

how do i get the changes into the database ?

after the page is loaded the dataset is gone so the databinding only works for reading ?
do i really have to make an array and handle the updating myself ?

regards
geir sanne

Nov 18 '05 #3

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

Similar topics

7
by: Paige | last post by:
I have a database on my local machine that I make entries and corrections on. I'd like to be able to upload that to my server and have that update the database that's on the server. What I've been...
3
by: Robin Tucker | last post by:
Hi there, I have a database on my test machine that will need to be installed on users machines. I would like to create the database with the given schema on the users machine and also with...
3
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be...
2
by: Niels Jensen | last post by:
I have a some code which imports information from a text file to a dataset. Depending op what is being extracted from the text file, the dataset has 5 tables which can be written to. During this...
2
by: Commander Ace | last post by:
Hi, I'm having some problems with updating an SQL Database with modified fields from a datatable. I got the code from a Wrox book, 'Professional VB.NET 2003', the same code can be found here:...
3
by: RSH | last post by:
Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment. Both servers contain the same databases...
6
by: mike11d11 | last post by:
I'm trying to create an application that will have multiple users working off a table on a SQL server. Since multi users will be updating different records at any given moment, how can i get those...
0
by: OldStd | last post by:
Updating data using 2 data sets I am having some problems in updating the database using two datasets as suggested by someone. 1. Data is displayed in a data grid from a dataset generated using...
33
by: bill | last post by:
In an application I am writing the user can define a series of steps to be followed. I save them in a sql database using the field "order" (a smallint) as the primary key. (there are in the range...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.