473,626 Members | 3,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

update database when datagridview changes

11 New Member
here's my code in filling a datagridview,wh ich i retrieve from database mysql,

Expand|Select|Wrap|Line Numbers
  1.         dim sql as String
  2.         sql = "SELECT * FROM table_user"
  3.         Dim myData As New DataTable
  4.  
  5.         comm.Connection = conn
  6.         conn.Open()
  7.  
  8.        ' comm.CommandType = CommandType.Text
  9.         comm.CommandText = sql
  10.         myAdapter.SelectCommand = comm
  11.         myAdapter.Fill(myData)
  12.  
  13.  
  14.        DataGridView1.DataSource = myData
  15.  
  16.  
So here's my question(just as you read from my title),
how to update database when values in the datagrid change?

please help,
arjel
Feb 4 '09 #1
1 15149
adsaca
11 New Member
i've already found a solution to my problem, and here's what i did.

Expand|Select|Wrap|Line Numbers
  1.  
  2. myAdapter.Update(myData , "table_user")
  3.  
  4.  
Feb 4 '09 #2

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

Similar topics

3
11765
by: thomasp | last post by:
I know this is a vague question, but I am not sure what information to give. I am using VB2005 beta and the datagridview is pulling data from one of three tables in an Access database. For some reason when I edit the feilds that I have not set as readonly, the changes do not get written to the database. I have the code that loads the datagridview posted below. Thanks for any suggestions. Thanks, Thomas
1
3134
by: Joaquin | last post by:
OK, I hate myself for asking this, it's the worst question I have ever asked but it's worse not to ask: ¿How do I update a datatable in vs 2005? I mean, I am using a typed dataset, a datagridview control and SQL express. I tried this code on a separate button to commit changes to the database: Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOK.Click If Not Me.DataSet.DataTable.GetChanges...
5
2159
by: explode | last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As String) that creates a new oledbDataAdapter with insert update select and delete commads. I also added that commands can change depending how many columns are in a Table. I add a new column with this code: Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Try...
3
3087
by: =?Utf-8?B?THVib21pcg==?= | last post by:
Hi, I have a DataGridView that displays data from one table from database. I didn’t implement any my code, I just used wizard to do all the work with DatagridView populating. Visual Studio generated strong typed dataset and binding. And here is my problem. I try to update the database with the new (changes) values from DataGridView:
1
3500
by: gaya12 | last post by:
I have a table called Student in a SQL databse.. I have to create a simple windows application in C# to Retrieve that table for the following functions.. 1.Add Data 2.Update Data 3.View Data For this Im using Datagridview and ADO.NET.. Im able to view the data.. but I dont know how to Add and update data... When I add/update the changes should be done in the SQL database.. How can I do that? Any help? This is the method Im using for...
3
2944
by: sampalmer21 | last post by:
Hi, If I update a cell in the DataGridView control, I use the DataAdapter.Update(DataTable) method to update the database, but when I restart the application my changes are not in the database. Anyone have an idea? Here is my code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text;
0
1324
by: sonia.sardana | last post by:
I m using ADODB+ SQL. Mine SQL table is create database student use student create table stu_table(roll int primary key,name varchar(10), marks int)
1
2774
by: Arved Sandstrom | last post by:
This seems to be something so simple that none of the hundred-odd tutorials and forum threads that I have looked at (:-)) apparently thinks it's a problem. In a nutshell, I have two DataGridViews. Each has a BindingSource (and a BindingNavigator). The first view populates successfully based upon a Linq to SQL query in the Form Load (that is, the query is assigned to the DataSource of that view's BindingSource, and the BindingSource is...
1
4547
by: adsaca | last post by:
database: MySQL i use connector i have two tables with the following contents: tbl_user_info user_id(Primary Key) fname lname
0
8262
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
8196
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
8637
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...
0
7192
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6122
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
5571
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();...
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1507
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.