how to save from datagrid

karthikeyan

Member
Joined
Oct 22, 2005
Messages
12
Programming Experience
Beginner
hi
i have one datagrid andi button in my table.i am retreiveing records from my table to datagrid.there are 5 columns in my table so those will be displayed in my datagrid,in that one column fully blank i am going to fill that in the datagrid.my need id after filling those empy row in the datagriod and if i press that button it has to be save in my database.ie i am going to type in my datagrid and i want ot save those things in my datagrid,plese tell me how to do,can u give coding to do that please
 
please go into your vbdotnet forum profile and set the option relevant to the version of VS you are using. the advice we can offer varies according to your version, particularly in issues of database interaction, so its important for us to have this information (what version of .net you use) in order to give accurate answers without constant questioning of your environment
 
first, please click this link:
http://www.vbdotnetforums.com/profile.php?do=editprofile

set your "Primary Dev Platform" to VS2003 - it will save you having to answer the "what .net version" question repeatedly and really helps out the other people ehre on the forums

As for saving your grid, I actually work with .net 2.0 and I skipped over .net 1.1's data facilities, as the work I was doing was all stored procedure calls, so I'm not 100% suited to answer your question.

However, As a basic guide I can tell you:

DataGrid in .net is actually called DataGridView - a name change which highlights that the control isnt supposed to store any data of its own, its merely a view of a set of data. the actual data is held in some other container, like a DataTable
So, populate a DataTable with the info from your HTML table, and assign it to be the datasource for the datagridview. The DGView will show the data.
This link will provide much information about the DGV:
http://msdn2.microsoft.com/en-us/library/e0ywh3cz.aspx

When you come to save the data to a database, you are going to use a DataAdapter in conjunction with the DataTable.. You tell the dataAdapter the query necessary to perform the update/insert and how the data maps to the database table and it does the rest when you call insert/update and pass the DataTable
For a detailed explanation, see this link:
http://www.google.co.uk/search?sour...8&rls=GGLG,GGLG:2006-25,GGLG:en&q=dataadapter

Any results that mention how to update a data base using a dataadapter will be of interest. Also check out microsoft's page on dataadapters:
http://msdn2.microsoft.com/en-us/library/system.data.common.dataadapter.aspx


And dont forget to update your profile here on vbdn forums! Thanks!
 
Back
Top