Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > UpdateCommand in GridView
 

UpdateCommand in GridView

Why do I need do specifify updatecommand for some gridviews/datasources and not all? havent done this for most of my gridviews and they work fine, updating back to the sql database. But for one datagridview it demands and updatecommand or otherwise i get an expception.

All Datagridviews are addedd in the same way and all of them for really simple tables, no fancy sql, just show everything from a table.

KristianSv  Friday, February 23, 2007 1:04 PM
Sometimes one of the column names in a table you add as a datasource is a keyword. If a column name is a key word you need to enclose the [column name] in brackets. Maybe change the sql statement from Select * from MyTable to Select [Col1], [col2], [col3] From MyTable so when the update command is generated it will have the column name in [ ]
Ken Tucker  Friday, February 23, 2007 6:38 PM

dont think an of these names should trigger that effect?

id, navn, beskrivelse, status, lokasjon, kommentar, tlf, radio

KristianSv  Friday, February 23, 2007 7:52 PM

You can use google to search for other answers

Custom Search

More Threads

• Appending rows to a bindingsource?
• typed DataSet not loading relations from DB
• Help regarding populating gridview
• DataGridView Master/Detail Bug - How to work around without dategridview?
• Deleting and modifying a row in a datagrid
• Binding a GridView to a different datasource
• Windows Forms Datagrid Problem
• TableAdapter.Fill cannot convert from 'System.Data.DataTable'
• Totals...
• cannot connect to Database