So lost with DGV's

JoshK

Member
Joined
Apr 12, 2006
Messages
10
Location
Akron, OH
can someone clear me up on a few things. Ive search for answers and the more I read and think I have it, there comes something that gets me *** backward. If I could get a deffinate answer on a few of these things it would just be superb.

1. is a datagrid same thing as datagridview?
2. what is the difference between dgv.datasource and dgv.databinding


for the next question I am refering to this snip I found in VB2005 beta 2 help:

Create a command builder to generate SQL update, insert, and
delete commands based on selectCommand. These are used to
update the database.
Dim commandBuilder As New SqlCommandBuilder(Me.dataAdapter)


Populate a new data table and bind it to the BindingSource.
Dim table As New DataTable()
table.Locale = System.Globalization.CultureInfo.InvariantCulture
Me.dataAdapter.Fill(table)
Me.bindingSource1.DataSource = table

That part in bold shocked me. Is it possible for VB to monitor changes made to the DGV on its own and construct the sql UPDATE command to update only the value(s) that the user changed??! Ive been tracking changes with code and then writing code to check what was changed and send the UPDATEs if needed.

btw I use mySQL and the mysql VB connector.


Excuse me for any pain I cause with asking about DGVs. I know there are alot of topics on them and the answer may already be out there but I just cant find it. This is also my first post to any programming forum, so I hope once you all make me a VB.god I can return the favor.
 
Some answers from a VB pupil

JoshK said:
1. is a datagrid same thing as datagridview?
The DataGridView is the new grid control in Visual Studio 2005 that adds a lot of functionality that the DataGrid in 2003 lacked. Of course, they kept the DataGrid in 2005 for backwards compatibility and for those people that say that the DataGridView is too slow.

JoshK said:
2. what is the difference between dgv.datasource and dgv.databinding
Not that I have used DataBindings before, but Ill try to answer this anyway. The DataSource is the BindingSource object to which the entire DataGridView is bound (the DataGridView shows the contents of the BindingSource fields in the grid). While the DataBindings allow you to bind data to the individual properties of the DataGridView.

JoshK said:
for the next question I am refering to this snip I found in VB2005 beta 2 help:

Create a command builder to generate SQL update, insert, and
delete commands based on selectCommand. These are used to
update the database.
Dim commandBuilder As New SqlCommandBuilder(Me.dataAdapter)
...
Is it possible for VB to monitor changes made to the DGV on its own and construct the sql UPDATE command to update only the value(s) that the user changed??!
Sort of. The CommandBuilder simply creates generic Insert, Update, and Delete commands based on the Select command that you entered. I still prefer to write my own commands so that I am sure of what is going on. I dont like to leave my data integrity to "automatic" tools. At a minimum I would check what the CommandBuilder creates before using it.

JoshK said:
Excuse me for any pain I cause with asking about DGVs. I know there are alot of topics on them and the answer may already be out there but I just cant find it. This is also my first post to any programming forum, so I hope once you all make me a VB.god I can return the favor.
DataGridViews have been complicated for most of us. While I dont think the people on this forum can make you into a "VB God", they can definitely help you when you get stuck on the road to your goal of ascention (if that is even an attainable goal ;)). I am, by no means, a VB God...especially in the area of Data access. But, I have been fighting my way through the learning process for a couple of years now. This forum has been of great help to me. So, I like to give my input whenever I feel confident enough to do so.

To the VB Gods out there...feel free to correct me if I have stated something stupid. :-\

Todd
 
Back
Top