开发者

Updating an entry in an ASP.net SQL Database

Using an SQLDataSource, how do I update entries by the uniqueID key? It's a simple开发者_运维百科 question but I am soooo confused! I need to edit a value named "pageContent". It is the value that I need to update!

Cheers!

EDIT

This ones for you Jorge:

[key] id/int (No Nulls)

  pageContent/nvarchar(MAX) (No Nulls)

Current Content:

[ id ] [ pageContent ]

1 <b>test</b>

2 test


SqlDataSource is used to bind database data to controls on web page and not to preform direct operations on database.

If you just need to update one column in table on given key, consider using System.Data.SqlClient.SqlConnection class to connect to db and System.Data.SqlClient.SqlCommand class to execute sql statement.

EDIT: Example of use very similar to your case is in SqlCommand.Parameters help: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.parameters.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜