Solved

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

Posted on 2008-10-03
2
340 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net/SQL prevent a table from being deleted ever 7 34
Open a word document 23 33
Data is not showing from images 15 37
Variable Event ? 3 23
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now