Re: Modifying Data in a GridView Web Server Control

Re: Modifying Data in a GridView Web Server Control

am 31.03.2008 19:28:55 von GaryDean

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

"Steven Cheng [MSFT]" wrote in message
news:vhl9doukIHA.360@TK2MSFTNGHUB02.phx.gbl...
> 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/de fault.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"
>>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).a spx
>>
>>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
>>
>>
>>
>>
>

Re: Modifying Data in a GridView Web Server Control

am 01.04.2008 04:01:43 von stcheng

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/de fault.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "GaryDean"
>References: <#Y7PBmskIHA.5160@TK2MSFTNGP05.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
>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
>
>"Steven Cheng [MSFT]" wrote in message
>news:vhl9doukIHA.360@TK2MSFTNGHUB02.phx.gbl...
>> 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
>>