Updating datagridview in c the dating game spiess
In my case, I have a method that return the values for two columns that I have on my datagridview.
Configuration; namespace GRP_02_03_SACP So, in that Method That Return List() you can build a List (List is a class) with all the items you need.
Also see How to: Bind Data to the Windows Forms Data Grid View Control Using the Designer.
Run(New Form1()) End Sub ' Initialize the form.
When you generate a strongly typed dataset (STD), you get four update methods taking: 1) a (STD) dataset 2) a (STD) datatable 3) a Data Row 4) an array of Data Rows. (1) As I said before, there is no UPDATE method in the table adapter.
If you also check the "Create methods to send updates directly to the database", then you get an update method with a parameter for each column. David if the dataset was auto generated by the studio it will automatically bind those parameters to the columns in a datatable contained in ur dataset like take an example u have a table in ur dataset called "Employee" and it has three fields empid,name,age then if empid is ur promary key the designer generated update command would be like would be like "update employee set empname = @empname , empage = @empage where emid = @empid" u neednt provide these parametrs the designer would have binded these parameters to ur coreesponding columns in the employee table if ur interested this is how its done first we set the adapter.update command to the above said query the we add sql parameters to the update command like Adapter. If I try to add one now, the wizard presents me with a dialog box with UPDATE and expects me to type the entire query. (2) If I start from scratch with a new Data Set/Table Adapter over my database view, the same happens.
if u r trying to update a view i would suggest not to do thatthere are lot of problems working with updatable views ..first of all u should have all the tables of the table which u intend to update in ur view then only the view is updatable..i'm not sure on this..i would prefer updating a table rather that a view.. Update method u are not calling the Update Command but in fact all the three commands are involved The Inser Command the Update Command and the Delete Command the adapter calls each command wrt to the Row State of the Data Row in the Data Table which can be Added, Modified, Deleted, Un C gauthampj- The only reason I was using a view was because it was a single table with about 40 fields, only 5 of which are in my Data Grid View. ur problem is that u are using a view to dsplay the records and because this view has only five fields from the table this view wont be updatable so u cant rely on the designer's defult commands which will be written based on this view and would obviously fail..
Data Source = table ' Resize the Data Grid View columns to fit the newly loaded content. Auto Resize Columns( _ Data Grid View Auto Size Columns Mode.
if u have to use the view and update ur orginal table i dont think there is another way other than building the commands as i showed earlier..
Gautham Please explain what you mean by: if u were using the table intead and only specifying (selecting in the designer) the fields u want then the command would be built correctly by the designer and would work..
I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing.
Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S. I understand what you suggested, and i will try when I return to work on Monday.
For more information, see Protecting Connection Information.