473,407 Members | 2,676 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,407 software developers and data experts.

Updating and inserting with Datasets

VB.net ( 2003 ) & SQL 2005

Thank you for all the help in navigating through the dataset using the
CurrencyManager.
However im now stuck on the next part , Updating, and addind records.
how can i

1. Client_RS.HasChanges(DataRowState.Modified), update the dataset with the
amended data and
pass that through to the SQL server. Can this be done through the dataset
or will i need
to use a direct update SQL command and then reload the dataset?
2. Add a new record?
3. Cancel any changes and revert back to the origional data before the
changes are comited

any simple examples would be very usefull in helping to understand how the
macanics work

Thank you in advance

Private Manager As CurrencyManager
Private Client_RS As New DataSet

' Load the DataSet with the client admin recordset
Private Sub LoadDataSet()
' Try to retrieve the records
Try
Client_RS = GetSQLDataSet("EXEC Bossdata.dbo.SQL2005_ADMINRS")
Try
LoadControls(0)
BindControls()

Catch ex As Exception
MsgBox("Error Seeking 1st Record " & ex.Message)
End Try

Catch ex As Exception
' Pit In error trapping Here
MsgBox("Error Generating Recordset " & ex.Message)
End Try
End Sub

Protected Sub BindControls()
' Bind the controls to the dataset
'Licence
strLicence.DataBindings.Add("text", Client_RS,
"TBL_ClientAdmin.Licence")
' Company Name
strCompanyName.DataBindings.Add(New Binding("Text", Client_RS,
"TBL_ClientAdmin.CompanyName"))
' Set the Manager position to the current record
Manager = Me.BindingContext(Client_RS, "TBL_ClientAdmin")
End Sub

' Check For Any Data Changes
Private Sub ValidateChanges()
If Client_RS.HasChanges(DataRowState.Modified) Then
' MsgBox(" Changed ")
Else
' MsgBox(" Not Changed ")
End If
End Sub
Jul 10 '06 #1
0 861

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

Similar topics

1
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try...
4
by: Darrel | last post by:
I'm creating a table that contains multiple records pulled out of the database. I'm building the table myself and passing it to the page since the table needs to be fairly customized (ie, a...
9
by: Mr Newbie | last post by:
HI People, Thanks to all who helped me earlier on the subject of @@IDentity. However, I seem to have hit another snagette! My DataSet contains two tables from the SQL Server. lets say Master...
6
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
13
by: mfreeman | last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown below. All I do is loop through the records in the table and update them without making any changes. Out of 600 records, about...
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...
3
by: Surya | last post by:
Dear All, I have problem on inserting a record to database..Although it looked easy.. i have caught up with following issue .. please go ahead and help me to find solution I Need to insert...
5
by: rosaryshop | last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php. As the user makes selections, it updates images of various parts, giving them a preview of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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.