DataGridView and Database - edit, update table on save of datagridview.

Hello,

            I have a datagridview and user is allowed to add rows. Changes made is to be reflected in the database. This is the datagrid and
Column name, Valuetype, allow nulls
Column name, valuetype, allow nulls
Column name, Valuetype, allow nulls
Column name, valuetype, allow nulls

 Here the column name should be inserted into the database as a column name. the value type is the value feild to the database. So if a save button is clicked databse should be created / updataed for the same. Also if column is to be added dynamically at run time how to handle the same for database...


ashish
0
ashishsagarwal
11/18/2008 2:56:55 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
1174 Views

Similar Articles

[PageSpeed] 4
Get it on Google Play
Get it on Apple App Store

Hi ashishsagarwal,

Get value from DataGrid for adding column, and assign these value into SQL statement for alter table: http://www.techonthenet.com/sql/tables/alter_table.php

Then do execute sql.

Thanks,


Qin Dian Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Qin
11/20/2008 9:02:29 AM
Reply:

Similar Artilces:

on update something in the datagridview, it should be updated in the database and datagridview should be refreshed with the updated data
1. I have a Windows Form app where I am binding a DagridView to a Dataset which was filled from a SQL Server database table. 2. I then have a method to Update the database.3. Problem: My Update method no longer works.  And also I wanted to do insert and delete operations in the datagridview. When I update something in the datagridview, it should be updated in the database and datagridview should be refreshed with the updated data.  I have wasted total day in searching of 'how to insert delete and edit the datagridview and that updates database as well. Please help me. Its a W...

DataGridView update to database
I created - a simple table in SQL Server Management Studio Express called employees(first_name,last_name,age,address,postal_code). - a windows/web C# app - Activate the Data->Show Data Sources window, drag employees onto the form/page A DataSet, BindingSource, TableAdapter, BindingNavigator are created automatically. Some code is created automatically:this.Validate(); this.employeesBindingSource.EndEdit(); this.employeesTableAdapter.Update(this.homeDataSet.employees); When I run this app, the DataGridView pulls data from the table and displays it. I delete a row and click the sa...

How to add the data present in the controls to a table control without any database involvement.
Hi All,i am four controls where i will write the text and once i click the add button those should get added to the table .i want 6 columns fixed in the table and rows as many as required.i tried doing that taking a table server control and able to load the table.but the problem is whenver i am adding a new row the old one is gfetting overwritten by this and at the end i am getting only one row.  System.Web.UI.WebControls.Table t1 = new System.Web.UI.WebControls.Table();  i have declared the below one global TableRow tr; TableCell tc1; TableCell tc2; TableCell tc...

Problem with update when updating all rows of a table through dataset and saving back to database
Hi, I have an application where I'm filling a dataset with values from a table. This table has no primary key. Then I iterate through each row of the dataset and I compute the value of one of the columns and then update that value in the dataset row. The problem I'm having is that when the database gets updated by the SqlDataAdapter.Update() method, the same value shows up under that column for all rows. I think my Update Command is not correct since I'm not specifying a where clause and hence it is using just the value lastly computed in the dataset to update the entire databas...

Updation of datagridview in vb.net
Hi to allnow i would like to update the database through datagridview  in VB.NET...can anyone help me regarding this issue..........  Thanks to all ......  Hi:   You can read this tutorial first: VB GridView Updating http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gridview.aspx   RegardsSincerely,Allen ChenMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help. can any one help me out how to update records in DataGridView without using Data provider compone...

Textboxes to Update Database table
I have four text boxes and one dropdownlist where visitors enter company information.  When the visitor clicks the submit button I want to write this information into a database table. What is the simplest and most direct way to do this other than using rich controls such as Form, Details and GridView?   You can use either using code or datasource control to insert these user inputs into your table. I use the SqlDataSource as an example, I can drag a SqlDataSource to the page in design view and config the data source(generate insert command). The table should ha...

how to update the datagridview in vb .net 2005
Hi friends, I have a datagridview. It contains number of rows. Imagine if the user clicks any one of the row and click the update button, then that particular rows (one field i.e status should be changed in the database). Can you please give me the coding for it.  I need it in vb .net 2005. Thanks, venkat..  Use the following sample code. <%@ Page language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> Sub ...

how to save datagridview (data imported from ms excel) to an access database?
Hi guys,  I have a datagridview populated by import data from excel file. Now I need to save this to access database. This process will be repeated daily and data will be consistently added to database so I believe there would be INSERT query. Could you please tell me main steps to follow? I probably need to create new data table and data adapter but how ti bind this with existing data in datagridview? My access db is called test.mdb and there is one table called Students which contains two columns: Name and Amount. Same structure is the datagridview if that matters at all. Thanks, ...

DataGridView and OLAP (DataGridView as PivotTable)
Hello, i need some help:It is possible to implement a pivot table with DataGridView?I want to connect to a cube of Microsoft Analysis Server andshow the data of the cube..I could use the web component pivottable but i want make an own layout of the tableand want cusomize it as good as possible.Or it is possible to change the code of an Microsoft object? (AxMicrosoft.Office.Interop.OWC11.AxPivotTable)In other words - i want to write an own OLAP ViewerThank you for answers Dear, I want to use pivot table -from OWC 11- in my Asp.net page but i have facced these: i cant add OWC11 contro...

Updateing a Datagridview
I have an application where I am presenting data to the user with a DataGridView that has as its datasource a SqlDataSource. The data is presented fine and the user is able to edit the fields that they are allowed to just fine. The problem arises though when they click on a button to do an update on the database. The button creates a SqlCommand and this command goes out and modifies all record that meet a certain criteria. The records that are modified should no longer appear on the gridview, however the data in the SqlDataSource appears to not change, even though the page is reloading. &nb...

Updating Calender control based on table fields in MySql database
Hi there,Having looked at Zak's example in his book: Build your own asp.net website, I have seen good examples on AppointmentScheduler using ASP:Calender control. I need to apply the same procedure to work with Database rather than serialization. Is anyone on this forum mastered in calender controls? It might be simple to do, but I cannot get the logic right.Requirements: Admin user should be able to book a room based textboxes, listboxes and dropdownlists on the form. The reservation made should be displayed in the grid at the bottom. A reservation should be able to delete and update. User ...

What Database and Table save EXTRA INFORMATION from the “CreateUserWisard / CreateUserWisardStep” controls ?
By using the “CreateUserWisardStep” we can add input controls ( textbox, etc) to obtain extra information from users. The default fields are User Name, Password, E-mail, Confirm password, Security Question, Security Answer. This information is saved in the “aspnet_Users” and “aspnet_Membership” tables within ASPNETDB.mdf.   But if I add, for example, the “First Name” and “Last Name” fields into the “CreateUserWisard/ CreateUserWisardStep” controls, what database and what table will save them ?   Do I need to create a separate Database and Table for them or they can be saved in ...

Updating multiple tables in database using one Gridview control
I have a SQL datasource which performs a join on multiple tables which is displayed through a gridview. I would like to be able to edit the columns but can't figure out how to do an update on multiple tables at once. " SelectCommand="SELECT aspnet_Users.UserName, aspnet_Membership.Email, aspnet_Roles.RoleName, aspnet_Membership.IsApproved FROM aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId INNER JOIN aspnet_UsersInRoles ON aspnet_Membership.UserId = aspnet_UsersInRoles.UserId INNER JOIN aspnet_Roles ON aspnet_UsersInRo...

datagridview
i am using c# windows application.if click on button the datagridview values only invisible in grid.what is the step for that?i nees sample query    This is an ASP.NET forum so you'll probably be better off posting to a Windows Forms forum like this one instead - http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=2&SiteID=1"Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."...

datagridview
Hi reader, thanks for reading my problem. i am using data grid view and want to show some data in grid view from database. so i made the code below but it is giving error in this line dataAdapter.SelectCommand = command;   the code is in c# help me......   public SqlConnection connection;//=new SqlConnection(); public SqlCommand command;// = new SqlCommand(); public DataSet dataset;// = new DataSet(); public SqlDataAdapter dataAdapter; string str = "Data Source=raj;Initial Catalog=CCP;User ID=raj;Password=raj1"; ///////////////////////////////////////////   co...

Web resources about - DataGridView and Database - edit, update table on save of datagridview. - asp.net.presentation-controls

Newest 'entity-framework' Questions - Stack Overflow
Q&A for professional and enthusiast programmers

Mono 2.0 released, brings C# 3.0 to Linux and Mac OS X
The Mono project, which develops an open-source and cross-platform …

CodePlex - Project Directory
Project hosting for open source software.

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

C# Corner - Developers and IT Professionals Community
Community for Developers and IT Professionals

Synchronize Now! - Dr Dobb's
Eric uses Amazon.com's S3 web service and .NET 2.0's FtpWebRequest class to securely synchronize files on multiple machines.

Design Patterns: Architecture of an Autonomous Application
Sign in MSDN subscriptions Get tools http://www.facebook.com/microsoftdeveloper https://twitter.com/msdev http://plus.google.com/111221966647232053570/ ...

Utilities - Software Downloads - PCWorld
Utilities downloads software and reviews .NET DataGridView Columns assembly for .NET 2.0, 3.0, 3.

Tutorials - Switch on the Code
Username: Password: Register - Forgot Password Home Tutorials Forums News & Other Posts Podcast About Us Contact Us Tutorials .NET C# Snippet ...

Q&A
VisualBuilder is a developer and programming site providing Tutorials, Articles, Source Code, Components, Answers, Books for Java, .NET, Web ...

Resources last updated: 12/10/2015 11:46:14 AM