Vs2005新开始
昨天msdn发布Announcing the Release of Visual Studio 2005 Beta 1 ,下载回来试用.
在还在测试着GridView和Data Source Controls等等处理数据的组件.11:40:28
就正如 More Load, Less Code with the Data Enhancements of ASP.NET 2.0说的:
The advent of data source controls do not make ADO.NET objects unnecessary; they are still essential pieces of the .NET Framework, but they have been removed from prime time and pushed to the back-end infrastructure of most common data binding operations.
![]() |
|
Ado. net已经没有以前那么重要了,以后我们用得更多将会是DataSource. DataSource共有六种类型, 这六种类型分两类:
Tabular Controls: AccessDataSource, DataSetDataSource, ObjectDataSource, SqlDataSource
Hierarchical Controls: SiteMapDataSource, XmlDataSource
DataSource在Vs2005里面设置DataSource是一件非常容易的事情
<asp:TextBox runat="server" ID="EmpID" Text="3" />
<asp:SqlDataSource runat="server"
ID="MySource"
ConnectionString="SERVER=(local);
DATABASE=northwind;Integrated Security=SSPI;"
SelectCommand="SELECT * FROM employees WHERE employeeid > @MinID">
<SelectParameters>
<asp:ControlParameter Name="MinID"
ControlId="EmpID"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
设置好DataSource, 主要是ConnectionString, SelectCommand.(除了Select,还有select, insert, update, and delete)
DridView设置DataSourceId="MySource" .就可以把绑定数据,显示出来.
<asp:SqlDataSource runat="server"
ID="MySource"
ConnectionString="SERVER=(local);
DATABASE=northwind;Integrated Security=SSPI;"
SelectCommand="SELECT * FROM employees WHERE employeeid > @MinID">
<SelectParameters>
<asp:ControlParameter Name="MinID"
ControlId="EmpID"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>设置好DataSource, 主要是ConnectionString, SelectCommand.(除了Select,还有select, insert, update, and delete)
DridView设置DataSourceId="MySource" .就可以把绑定数据,显示出来.

浙公网安备 33010602011771号