Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Modifying Data in a GridView Web Server Control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GaryDean - 31 Mar 2008 01:52 GMT
The title of this post is the subject of an MSDN article at:
http://msdn2.microsoft.com/en-us/library/c4245bb4(VS.80).aspx

The article describes generating a sqldatasource that has select, update,
delete, and insert statments and basically accomplishing maintenance through
a datagrid with no coding.  The problem is that, like earlier 1.1 articles,
it doesn't work.  The edit button opens up a textbox and allows a new entry
but no update occurs.

Back in 1.1 we had to execute the stored procedures ourselves in code in the
rowcommand event.

Do we still have to do it the old fashioned way or does the gridview
actually somehow have this advertised updating capability?
Thanks,
Gary
Steven Cheng [MSFT] - 31 Mar 2008 05:45 GMT
Hi Gary,

As for .NET 2.0 GridView (or DataGrid) that associate with DataSource
control, it does support AD hoc data access such as query, update, delete
without writing code.  Actually, it is easy to perform such a task through
a simple database table. e.g.

** drag a data source control onto the page and configure it, make sure you
choose generate update/insert/delete query together with select query

** drag a gridview on to page and bind to the datasource control added
previously

** in the Gridview action list, choose to enable "Editing", "Deleting"

then, run the page, you should be able to select, edit, delete records.
This is just for very simple AD HOC scenarios.  Are you encoutering any
particular error when running the page?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "GaryDean" <gdeanblakely@newsgroup.nospam>
>Subject: Modifying Data in a GridView Web Server Control
>Date: Sun, 30 Mar 2008 17:52:31 -0700

>The title of this post is the subject of an MSDN article at:
>http://msdn2.microsoft.com/en-us/library/c4245bb4(VS.80).aspx
[quoted text clipped - 12 lines]
>Thanks,
>Gary
GaryDean - 31 Mar 2008 18:28 GMT
Steven:
Well, first the SQLDatasource doesn't have an option for automatically
generating update, insert, delete (as does the xsd generator) that I can
find.  So I use the xsd generator to generate stored procedures, I put then
into the database and then drag a sqldatasource onto the page, specify the
individual stored procedures, drag a gridview, hook it up and specify
editing.

When I run it I can edit, enter a new value in a column just fine.  The only
problem is that the update does not occur.

Gary

> Hi Gary,
>
[quoted text clipped - 73 lines]
>>Thanks,
>>Gary
Steven Cheng [MSFT] - 01 Apr 2008 03:01 GMT
Hi Gary,

As for generating the update/delete statementes, you can do it as below(in
SqlDataSource):

** In Design-view on page, select SQLDataSource and click "Configure
DataSource" action item in the action panel

**After choose data connection, you're brought to "configure the select
statement page"

**You can choose "specify columns from table or view"(the default setting),
then you can find a "Advanced" button on the right side of the dialog

**Click the "advanced" button, and you'll find the option to let you
generate Insert,Update,Insert statement

Please feel free to let me know if you still have difficulites got it
working. BTW, as I mentioned, this is for ad hoc scenarios, for complex
data manipulating, we generally create custom dataset/table adpater or data
access class to do the work.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "GaryDean" <gdeanblakely@newsgroup.nospam>
>References: <#Y7PBmskIHA.5160@TK2MSFTNGP05.phx.gbl>
<vhl9doukIHA.360@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Modifying Data in a GridView Web Server Control
>Date: Mon, 31 Mar 2008 10:28:55 -0700

>Steven:
>Well, first the SQLDatasource doesn't have an option for automatically
[quoted text clipped - 34 lines]
>>
>> Microsoft MSDN Online Support Lead

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.