当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 使用CommandBuilder为DataAdaper生成的Command更新数据源时的注意事项!

ASP.NET
HTML服务器控件介绍:HtmlInputFile控件
HTML服务器控件介绍:HtmlInputHidden控件
HTML服务器控件介绍:HtmlInputImage控件
HTML服务器控件介绍:HtmlInputRadioButton控件
HTML服务器控件介绍:HtmlInputText控件
HTML服务器控件介绍:HtmlSelect控件
HTML服务器控件介绍:HtmlTable控件
HTML服务器控件介绍:HtmlTableCell控件
HTML服务器控件介绍:HtmlTableRow控件
HTML服务器控件介绍:HtmlTextArea控件
Web服务器控件:AdRotator控件
Web服务器控件:Button控件
Web服务器控件:Calendar控件
Web服务器控件:CheckBox控件
Web服务器控件:CheckBoxList控件
Web服务器控件:DropDownList控件
Web服务器控件:HyperLink控件
Web服务器控件:Image控件
Web服务器控件:ImageButton控件
Web服务器控件:Label控件

ASP.NET 中的 使用CommandBuilder为DataAdaper生成的Command更新数据源时的注意事项!


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 178 ::
收藏到网摘: n/a


1.SelectCommand使用的select命令中必须包含主键(primary key)!
2.填充数据集时,使用如下方法:
da.FillSchema(ds,SchemaType.Source, "TableName"); //加载表架构 注意
da.Fill(dsPubs,"TableName"); //加载表数据
3. DataAdapter 的 MissingSchemaAction 属性设置为 AddWithKey
4.构造CommandBuilder对象时,将DataAdapter对象作为构造函数参数传入:
SqlCommandBuilder objCommandBuilder = new SqlCommandBuilder(da);5.增加行,修改行,删除行;6.调用DataAdapter的update方法更新数据源!7.更新数据源成功,调用ds的Acceptchanges()方法,更新数据集!