Update a DataGridView without a CommandBuilder

sfx

Well-known member
Joined
Jan 31, 2006
Messages
46
Programming Experience
Beginner
Hello All,

I have a DataGridView that has as its datasource a DataSet. Does anyone know how I might update the DataGridView (and in turn the database) without using a CommandBuilder object? I am unsure of the syntax needed in order to evaluate the appropriate DataAdapter parameters for this. Any ideas?

Cheers,

sfx
 
Hi Kulrom,

I recognise that the DataAdapter, DataSet and DataGridView are the easiest way to work with columned data. However, my question pertained to how I can manage the DataAdapter's update process through code instead of relying on the CommandBuilder object to generate this for me. Although the CommandBuilder is fine for simple select queries, if my DataGrid contains information from two or more tables then I will have to formulate the update statement myself. Do you have any examples of how this might be done?

And no, I think I would prefer to be a programmer... ;)

Cheers,

sfx
 
Hi Vis,

Nice to hear from you again!

Yes, I am having trouble with the SQL statements (and ADO.NET parameters) for updating a DataGridView when it pulls information from more than one table. I would like to code the requirements myself, so if you have any examples of how this might be done I would greatly appreciate it.

Cheers,

sfx
 
I'm confused sfx, you want to update a datagridview with SQL and parameters using a custom select statement? Or you want to update the data source? Either way i don't suppose it matters. The command builder provides you with a brilliant starting point for creating you own SQL. Have a look at what is generated. The only reason i don't use it is because i'm a control freak and i like to tell the computer what i want it to do rather than it having a guess based on a set of parameter provided by MS. But thats where i started out and once you get into it, it's fairly straight forward. As well as all the resources that are available on the web.
 
Hi Vis,

Actually, that is what I did. Once I generated the code I was then able to customise it to how I wanted. I guess I'm a bit like you - I like to 'know' the code behind my apps...

Thanks again,

sfx
 
If you do not want to use the CommandBuilder object, dim a new Command object and build if yourself then bind it to the dataAdapters.UpdateCommand and run Update().

As most of you I like control better ;)
 
Back
Top