Solved

What are the ways to display/update grid data using WinForms and WebForms?

Posted on 2008-10-03
2
347 Views
Last Modified: 2013-12-17
I want to play with creating a grid view for WinForms and WebForms which both give me read access to table data, but also to empower the user to  update by way of that same control.

Which of  these is read only?  Which allow me to write the data back to  the database.  I expect to set the Data Source to a DataSet.

Please tell me which controls do what type of  data access.  Also, how do I write the changes back to the DataSet, then force the DataSet to update the database?  Using C#.NET 2.0.


Thankls,
newbieweb


A web page can have a:

GridView
DetailsView
FormView

A WinForm can  have a:
DataGridViewer
ReportViewer
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
gemailj earned 250 total points
ID: 22640357
there a great difference between GridView (web) and DataGridViewer (Windows) because the nature of the web application is completely differ than Win application

you can make all your change in DataGridViewer and if the datasource of it is a dataset and the DataGridViewer allows editing and insertion the DataGridViewer write all changes to the dounded DataSet
the you can Call GetChanges() to Update them ---- this is the win apps disconnected scenario

but the GridView (web apps) the disconnected scenario is not applicable
you have to make the data change directly to the database
objDataAdapter.Update(ds.GetChanges()); //winforms
 
 
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            con.Open();
            SqlCommand cmd = new SqlCommand();
            //add the parameters values
            cmd.ExecuteNonQuery();
        }
        finally
        {
            con.Close();
        }
    }

Open in new window

0
 
LVL 6

Assisted Solution

by:RishadanPort
RishadanPort earned 250 total points
ID: 22640372
I am pretty sure that all of these WinForms have the ability for read and write access such that it also effects the Data Source.

I have used a DataGridView, and I am positive it has the ability of what you are trying to achieve, here is an example that uses DataGridView that binds the data to a data set

http://blog.paranoidferret.com/index.php/2007/09/05/c-tutorial-binding-a-datagridview-to-a-database/
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question