473,385 Members | 1,766 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,385 software developers and data experts.

Confusion about ADO.net

108 100+
Hi guys,
I'm currently studying ADO.net and I used video which I got from learnvisualstudio.net. I follow a the tutorial and I was able to create a simple apps which can load its content. My problem right now is that when I clicked the add and save, I was able to add/save but the database is not updated. Upon investigating the source code, I have'nt found a code regarding connection. What i remember is that during adding of the datasource, all of them are popup and created automatically. My question right now is how can I see/update the data on the database? I put code generated below.

Expand|Select|Wrap|Line Numbers
  1. namespace ADOTest2
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.         }
  9.  
  10.         private void customerBindingNavigatorSaveItem_Click(object sender, EventArgs e)
  11.         {
  12.             this.Validate();
  13.             this.customerBindingSource.EndEdit();
  14.             this.customerTableAdapter.Update(this.myCompanyDataSet.Customer);
  15.  
  16.         }
  17.  
  18.         private void Form1_Load(object sender, EventArgs e)
  19.         {
  20.             // TODO: This line of code loads data into the 'myCompanyDataSet.Customer' table. You can move, or remove it, as needed.
  21.             this.customerTableAdapter.Fill(this.myCompanyDataSet.Customer);
  22.         }
  23.  
  24.         private void button1_Click(object sender, EventArgs e)
  25.         {
  26.             Form2 f2 = new Form2();
  27.             f2.Show();
  28.         }
  29.     }
  30. }
Jan 23 '08 #1
2 967
Shashi Sadasivan
1,435 Expert 1GB
when you do the Update if any changes are made to the dataTable, the changes are update to the database.
the Update method also returns the number of rows that have been updated to the database. (that one way of checking)
if you do want to make sure that the database has the right values then Fill the datatable again as you did in Form_Load

Else, open the database console and query for the changes you made :)
Jan 23 '08 #2
romcab
108 100+
when you do the Update if any changes are made to the dataTable, the changes are update to the database.
the Update method also returns the number of rows that have been updated to the database. (that one way of checking)
if you do want to make sure that the database has the right values then Fill the datatable again as you did in Form_Load

Else, open the database console and query for the changes you made :)

Hi,

I can edit/add on the UI and upon next/previous the changes is fine. But if I close the application and run the program again, the changes I made is not save. When I looked at the content of the database using ShowTable data, database is not updated. Aside from that, why I can't see the code that perform connection to the dbase?
Jan 23 '08 #3

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

Similar topics

1
by: Doug Farrell | last post by:
Hi all, I'm trying to do the following from within a code module: import re # text to match text = "Good morning x something /x, how are you today x something else /x"
1
by: Mathias Mamsch | last post by:
Hi, I have some confusion concerning the weakref module. I am trying to save a weak reference to a bound member function of a class instance for using it as a callback function. But I always...
38
by: Grant Edwards | last post by:
In an interview at http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273 Alan Kay said something I really liked, and I think it applies equally well to Python as well as the languages...
10
by: Kamilche | last post by:
I'm trying to pack two characters into a single byte, and the shifting in Python has me confused. Essentially, it should be possible to use a 'packed string' format in Python, where as long as...
4
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though...
0
by: i_have_control | last post by:
I'd be grateful for any input on this one: I have three web domains. The destinations of two are set to folders on the first, though that fact is transparent to the user (i.e: it does not...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
10
by: joelagnel | last post by:
hi friends, i've been having this confusion for about a year, i want to know the exact difference between text and binary files. using the fwrite function in c, i wrote 2 bytes of integers in...
1
by: Richard Lewis Haggard | last post by:
I'm having a problem with what appears to be some sort of confusion with references. I have a single solution with a dozen projects which has been working quite nicely for a while. The references...
2
by: Riaaaa | last post by:
Hello, We are doing the project in VB.Net. We had a great confusion for ASP.Net and VB.Net. Is VB.Net project performed in Microsoft Visual Studio 2005 ?? We have...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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
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
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...

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.