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

Datagridview dropdownbox value changed

When i change the value in the dropdownbox.
The value changes.
When i check the datatable the value has changed
But when i want to save it to the database the record didnt got a
changed flag
When i do dtTest = dtData.getchanges then dtTest is nothing ???
But still the value in the datatable has the right value, but because
it didnt have a change flag it isnt saved to the database???

What i am doing wrong??

With _ColumnPositie
.HeaderText = "Positie"
.Width = 120
.DataSource = g_cDatabase.dtPositie
.DataPropertyName = "PlayerPositie"
.DisplayMember = "PositieOmschrijving"
.ValueMember = "Positie"
.Name = "cboPositie"
End With
dgvPlayers.Columns.Insert(3, _ColumnPositie)
mine update functie

Public Sub DBUpdate(ByVal dtData As DataTable, ByVal sTabelNaam As
String)

Dim daUpdate As New SqlDataAdapter()
daUpdate.SelectCommand = New SqlCommand("Select * from " &
sTabelNaam, _SQLConn)
Dim cbUpdate As SqlCommandBuilder = New
SqlCommandBuilder(daUpdate)

Dim dtTest As DataTable
dtTest = dtData.GetChanges

cbUpdate.GetDeleteCommand()
cbUpdate.GetInsertCommand()
cbUpdate.GetUpdateCommand()

daUpdate.Update(dtData)
dtData.AcceptChanges()
End Sub

and if a value changes:

Private Sub dgvPlayers_CellValueChanged(ByVal sender As Object, ByVal e
As System.Windows.Forms.DataGridViewCellEventArgs) Handles
dgvPlayers.CellValueChanged

If dgvPlayers.CurrentCell.ColumnIndex = 3 Then
g_cDatabase.DBUpdate(dgvPlayers.DataSource, "T_Players")
End If
end sub

Aug 2 '06 #1
0 890

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

Similar topics

6
by: thomas j | last post by:
Hi, I have a MySqlBase with a tabel named CARS and with 3 fields; CarsType, CarsModel, CarsInfo. Now I want to generate 2 dropdownboxes in PHP read from CARS. First I will "load" CarsType into...
2
by: Lars Netzel | last post by:
Hi I'm having a DropDown box with 2 items... one with Value 1 and one with Value 2. If I load the page and it has Value 1 selected from page_load() and then select Value 2 on the form.. .and...
7
by: steve | last post by:
Hi All I urgently need help on setting datagridview cell borders at runtime I found some code on the web from Programming Smart Client Data Applications with .NET 2.0 by Brian Noyes See...
1
by: Danny M | last post by:
Does anyone ave a good exsample on how you bind 2 tables into a datagridview where the second table is the values of a dropdownbox. With delete (whole row not dropdownbox table) and edit ?
3
by: Daniel Manes | last post by:
I need a strategy to debug this situation... I can't put all the code involved, but here are some of the critical lines with comments: ------------------------- Private _parentDataCell As...
4
by: Terry Olsen | last post by:
How can i tell if a row in my DataGridView has been edited? I'm loading a DataTable with ID3 information from MP3 files and using that as the datasource for the DataGridView. I'm letting the user...
1
by: sklett | last post by:
I've got a strange situation here. I have a databound DataGridView that also has un-bound columns. When the view loads, I want to update the values of the unbound columns. If I attempt to modify...
6
by: Miro | last post by:
Sorry for the cross post. I am stuck. I have a datagridview for poker rounds. Basically there are 3 columns in this datagridview. "Round" "SmallBlind" "BigBlind" I have an issue when I tab...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
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...
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
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
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.