473,748 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving Data from DataGridView into Database.

80 New Member
Hey guys,

I've been playing with this for a few days now and just can't seem to get it working.

I'll explain what I have to do:
Open a file and read it in to the datagridview (done)
Save data into the database. <- what I need help with

So what I've tried
Expand|Select|Wrap|Line Numbers
  1. private void btnUpdate_Click(object sender, EventArgs e) //TODO: Update Database met gegevens die zijn toegevoegd.
  2.         {
  3.             try
  4.             {
  5.                 connect.Open();
  6.                 dAdapter.Update(dTable);
  7.             }
  8.             catch (Exception ex)
  9.             {
  10.                 MessageBox.Show(ex.ToString());
  11.                 btnUpdate.Enabled = true;
  12.             }
  13.             finally
  14.             {
  15.                 connect.Close();
  16.             }
  17.         }
But this doesn't work, I don't get an error from the exception it just doesn't save. If someone would help it would be awesome.

Michael
Feb 18 '13 #1
0 1603

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

Similar topics

0
2686
by: Tommy Christian | last post by:
Hi! Anyone who knows about saving serialized data to database, coz I have a problem with that. If I just serialize my session data and then deserialize it, it works. But when I save it between those actions into Oracle database into long row field, it doesn´t. Below is some code.
5
1558
by: Tony | last post by:
Ok. im new to programming. and sorry for fuzzy discription :) I am using a program called leechget. this is download manager that i use on the net. When i add a dowload , i can see the information such as path , file name and size , etc, in the grid . but i can not find any file that saves those inforamtion. there are no database, no textfile or xml files. I was wondring , how those information been saved and where? As download manager,...
1
1199
by: pmclinn | last post by:
I have a formated a structure as follows: <Serializable()>public structure stcOutPut private data as string private visi as string end structure Instances of this strucuture are stored in an array list. Dim z as new arraylist
0
1555
by: RSH | last post by:
Hi, I have created a WinForm that uses a series of dynamic DDLs to select Databases/tables and then loads the data into a DataGridView. The 2.0 Datagridview allows users to reorder columns etc and I was wondering how I would go about saving the DataGridView Layout at then user/table level? I have heard about IPersistComponentSettings but I can't really find any code snippets or tutorials on how to use this. Any help would be greatly...
1
2599
by: Magnus | last post by:
I'm testing walkthrough saving data to a Database (Multiple Tables). http://msdn2.microsoft.com/en-us/library/4esb49b4(VS.80).aspx In the famous Customer/Order example, I'm getting referential integrity problems "The INSERT statement conflicted with the FOREIGN KEY constraint..." if the identity/primary key column is "out of sync" with the identity value in the database. I can easily acheive this f.ex. by pressing add new record,...
3
1146
by: csharpa | last post by:
Hi, I’m using VS2005 and I’m trying to link the C# windows form to MSSQL. I used BindingNavigator Control to read the data. After that I add sqlcommand and sqldataadapter to send the data to the database. My code is this sqlDataAdapter1.InsertCommand.CommandText = "INSERT INTO SUDENT (" + "S_ID, S_NAME, S_ADDRESS, S_PHONE" + ") VALUES ('" + S_IDComboBox.Text + "', '" + S_NAMETextBox.Text +...
0
1354
by: =?Utf-8?B?QkFUT04=?= | last post by:
I have realy big problem I try lot of things but never success! I need a HELP! Problem is in that I made database in Microsoft access and connect her to C# form and datagridview. and it shoving a data that I was inserted in it trough Office access. but when I try to insert some data in that database trough a C# form it (after refresh) show that data is inserted in datagridview but it never save in database!!!!!!!!!!!!
1
2590
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I made web site using asp.net 2.0 Vb.Net. The project depends on database in the local machine. The web site has • Create User Wizard and • Login form When the user is created the username and password saved in the database. And the code is as follows: Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e
2
1113
by: Zeljko Bilandzija | last post by:
Hi, can somebody help me in this? I want to insert some data in table on this way; i have button, and in Button_Click event handler i have integer variable with some data (for example, variable = 10), and i need to insert this data in database SomeBase, in table named SomeTable, in column named SomeColumn. (That column have only one record).
1
2206
by: Limno | last post by:
Can anyone suggest me how to pass datagridview data to database. Process must be like this, if the user enter multiple data into the datagridview after user press "save" button, datagridview data must be passed to database. Need C# code in windows application. It should have some comboxbox control in datagridview. Thanks in Advance.
0
8995
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6799
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.