Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

can someone clear me up on a few things. I've 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??! I've 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 DGV's. 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.

Posted

Some answers from a VB pupil

 

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.

 

2. what is the difference between dgv.datasource and dgv.databinding

Not that I have used DataBindings before, but I'll 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.

 

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 don't like to leave my data integrity to "automatic" tools. At a minimum I would check what the CommandBuilder creates before using it.

 

Excuse me for any pain I cause with asking about DGV's. 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' date=' so I hope once you all make me a VB.god I can return the favor.[/quote']

DataGridViews have been complicated for most of us. While I don't 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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...