Access data layer study notes.
2007-08-13 17:17
393 查看
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
INSERT INTO [Products] ([ProductName], [SupplierID], [CategoryID], [QuantityPerUnit], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [ReorderLevel], [Discontinued]) VALUES (@ProductName, @SupplierID, @CategoryID, @QuantityPerUnit, @UnitPrice, @UnitsInStock, @UnitsOnOrder, @ReorderLevel, @Discontinued);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
SELECT SCOP_IDENTITY();
----which will return the last identity value inserted into an IDENTITY column in the same scope. (See the technical documentation for more information about SCOPE_IDENTITY()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public partial class Northwind
{
public partial class SuppliersRow
{
public Northwind.ProductsDataTable GetProducts()
{
ProductsTableAdapter productsAdapter = new ProductsTableAdapter();
return productsAdapter.GetProductsBySupplierID(this.SupplierID);
}
}
}
<ItemTemplate>
<asp:BulletedList ID="BulletedList1" runat="server" DataSource='<%# ((Northwind.SuppliersRow)((System.Data.DataRowView) Container.DataItem).Row).GetProducts() %>'
DataTextField="ProductName">
</asp:BulletedList>
</ItemTemplate>
We define a function GetProducts in class SuppliersRow which is generater by vs automately , but this sample add a function . this amazing me .
let us analyse how to use this function in typed dataset(强类型)。 because this is function is use in class Northwind.SuppliersRow , so in the Html we have to convert it to this type .but I also want to know how to got the data , we must learn form this ((Northwind.SuppliersRow)((System.Data.DataRowView) Container.DataItem).Row).GetRowducts().
many knowledage I need to master .
delete and update nonqury retrun type will return a int value reprents the numuber of row it affect .
insert although it will return a value , but the bype is boject . I must take caer of this.
nonqury retrun type is int .
scalar return type is object .
that's all , I know all about this , nothing have to doubt.
相关文章推荐
- Data Access Layer (DAL) with SqlWrapper library
- Implement a Data Access Layer for Your App with ADO.NET
- Creating a Data Access Layer C#
- MvcAppEmployeesFromDb.DataAccessLayer
- 论坛App_Code DataAccessLayer(1)
- Writing a Portable Data Access Layer
- An SqlServer Store Procedure DataAccess Layer Class
- PHP – 架構設計 Data Access Layer 篇
- 采访分布式数据访问层(Data Access Layer)
- A Data Access Layer to persist business objects using attributes and reflection - Part I [无常译]
- Introduction: Creating a Data Access Layer
- 架构B/S四 DALFactory 数据访问层 Data Access Layer
- A Data Access Layer to persist business objects using attributes and reflection - Part III
- A Data Access Layer to persist business objects using attributes and reflection - Part I
- 采访分布式数据访问层(Data Access Layer)作者许超前
- A Data Access Layer to persist business objects using attributes and reflection - Part II [无常译]
- A Simple Data Access Layer using Hibernate
- MCITP Developer: Microsoft SQL Server 2005 Data Access Design and Optimization Study Guide
- PHP – 架構設計 Data Access Layer 篇
- Create the Data Access Layer