473,414 Members | 1,567 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.

Getting Data to Save to Database

I am new to programming and am sorry if this post is in the wrong area. I have a listbox bound to a table and a datagrid bound to another one with a connection through xml. I can change the data within the grid, with the following through a button on a different tab page within the form, but it does not save changes to the database, just shows them on the datagrid until the program is closed:
Expand|Select|Wrap|Line Numbers
  1. 'Temporary Datasets to store the inserted or modified rows
  2. Dim pdsInsertedRows, pdsModifiedRows As DataSet
  3.  
  4. 'Set the menu items to indicate that a record is being edited
  5. Call EditState(cblnNotEditing)
  6.  
  7. 'End editing on current record
  8. Me.BindingContext(DsClientServiceBinding1). _
  9. EndCurrentEdit()
  10.  
  11. 'copy the DataSet by getting the added or modified records from the
  12. 'origional bound Dataset
  13. pdsInsertedRows = DsClientServiceBinding1.GetChanges(DataRowState.Added)
  14. pdsModifiedRows = DsClientServiceBinding1.GetChanges(DataRowState.Modified)
  15.  
  16. 'Check to see if there is modified rows.  If there is update the Dataset
  17. If Not pdsModifiedRows Is Nothing Then
  18.     odbdaTickets1.Update (pdsModifiedRows)
  19. End If
  20.  
  21. 'Check to see if there are inserted rows and update
  22. If Not pdsInsertedRows Is Nothing Then
  23.     odbdaTickets1.Update (pdsInsertedRows)
  24. End If
  25.  
  26. 'Synchronize the database with the Dataset by accepting changes
  27. DsClientServiceBinding1.AcceptChanges()
  28.  
Thank you in advance for your help,
Apr 4 '07 #1
4 1982
Dököll
2,364 Expert 2GB
I am new to programming and am sorry if this post is in the wrong area. I have a listbox bound to a table and a datagrid bound to another one with a connection through xml. I can change the data within the grid, with the following through a button on a different tab page within the form, but it does not save changes to the database, just shows them on the datagrid until the program is closed:

'Temporary Datasets to store the inserted or modified rows
Dim pdsInsertedRows, pdsModifiedRows As DataSet

'Set the menu items to indicate that a record is being edited
Call EditState(cblnNotEditing)

'End editing on current record
Me.BindingContext(DsClientServiceBinding1). _
EndCurrentEdit()

'copy the DataSet by getting the added or modified records from the
'origional bound Dataset
pdsInsertedRows = DsClientServiceBinding1.GetChanges(DataRowState.Ad ded)
pdsModifiedRows = DsClientServiceBinding1.GetChanges(DataRowState.Mo dified)

'Check to see if there is modified rows. If there is update the Dataset
If Not pdsModifiedRows Is Nothing Then
odbdaTickets1.Update(pdsModifiedRows)
End If

'Check to see if there are inserted rows and update
If Not pdsInsertedRows Is Nothing Then
odbdaTickets1.Update(pdsInsertedRows)
End If

'Synchronize the database with the Dataset by accepting changes
DsClientServiceBinding1.AcceptChanges()

Thank you in advance for your help,
Greetings and salutations!

I think this is what you want, looked through it myself. You'll need to do some reading:

http://www.codeproject.com/cs/databa...select=1644938

In a bit, and have fun with the project...
Apr 5 '07 #2
Greetings and salutations!

I think this is what you want, looked through it myself. You'll need to do some reading:

http://www.codeproject.com/cs/databa...select=1644938

In a bit, and have fun with the project...
I am not sure I understand it. I have the connection, it reads the two tables, it lets me update and shows the changes in the tables on the form, but not in the database itself. Do I need to close and reopen the connection to update the actual database? Or am I missing something?
Apr 5 '07 #3
Dököll
2,364 Expert 2GB
I am not sure I understand it. I have the connection, it reads the two tables, it lets me update and shows the changes in the tables on the form, but not in the database itself. Do I need to close and reopen the connection to update the actual database? Or am I missing something?
Excuse the confusion. You are adding back to the database (updated data is being added to the database). Do you have a "Save" or Add to Databse" button? or something in that kind of a line! Do the data you have updated through xml have texboxes specific to them on your form? Your button to Add or Save should send to your database.

Perhpas this one is easier to understand, look up the insert command:

http://blogs.msdn.com/codemouse/default.aspx

Write again if not helpful...
Apr 5 '07 #4
Excuse the confusion. You are adding back to the database (updated data is being added to the database). Do you have a "Save" or Add to Databse" button? or something in that kind of a line! Do the data you have updated through xml have texboxes specific to them on your form? Your button to Add or Save should send to your database.

Perhpas this one is easier to understand, look up the insert command:

http://blogs.msdn.com/codemouse/default.aspx

Write again if not helpful...
I have an update button. The textboxes are tied through xml table relation. Does saving to the dataset not save to the database? I appreciate your help.
Apr 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Fabian | last post by:
Hello, Iam searching for a way to design a letter with Crystal Report. Now I want to imlement a table. I have the Data in a ArrayList, but it will not be able to make a Database, so I need a way...
2
by: PHP_Paul | last post by:
Ok, I'm trying to poineer into the wonderful area of PHP/MySQL programming, but I'm having some difficulties. http://www.paulhq.com/php/freepage.html should register, but when anyone fills something...
5
by: Mark | last post by:
I have a VB 6 program that I have saved an audio file to using DAO and the appendchunk as is shown at http://support.microsoft.com/kb/103257/EN-US/. ; I have it working fine in that app (it saves...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.