手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网络编程>Asp.Net编程>列表

Working with MS Access Stored Procedures in VB.NET Montaque(转贴)

来源:互联网 作者:西部数码 时间:2008-04-10
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!
  • Temporary tables are not available in Access.
  • I suspect many of the options available in Transact SQL are not available in Access as it''''s not Transact SQL compatible.
  • Conclusion

    Hopefully, this article has provided some guidance in a nearly undocumented area of Access and Jet not yet explored by most. For more information on how the ADO.NET code works in the CreateStoredProc subroutine, see Getting Started with ADO.NET by Gurneet Singh. The following is a complete listing of all code presented in this article:

    Imports System.Data Imports System.Data.OleDb Module CreateSP Sub Main() ProductsProcs() End Sub '''' Products Stored Procs to be added to the db. Sub ProductsProcs() Dim sSQL As String '''' procProductsList - Retrieves entire table sSQL = "CREATE PROC procProductsList AS SELECT * FROM Products;" CreateStoredProc(sSQL) '''' procProductsDeleteItem - Returns the details (one record) from the '''' JobTitle table sSQL = "CREATE PROC procProductsDeleteItem(@ProductID LONG) AS " _ & "DELETE FROM Products WHERE ProductID = @ProductID;" CreateStoredProc(sSQL) '''' procProductsAddItem - Add one record to the JobTitle table sSQL = "CREATE PROC procProductsAddItem(inProductName VARCHAR(40), " _ & "inSupplierID LONG, inCategoryID LONG) AS INSERT INTO " _ & "Products (ProductName, SupplierID, CategoryID) Values " _ & "(inProductName, inSupplierID, CategoryID);" CreateStoredProc(sSQL) '''' procProductsUpdateItem - Update one record on the JobTitle table sSQL = "CREATE PROC procProductsUpdateItem(inProductID LONG, " _ & "inProductName VARCHAR(40)) AS UPDATE Products SET " _ & "ProductName = inProductName WHERE ProductID = inProductID;" CreateStoredProc(sSQL) End Sub '''' Execute the creation of Stored Procedures Sub CreateStoredProc(ByVal sSQL As String) Dim con As OleDbConnection Dim cmd As OleDbCommand = New OleDbCommand() Dim da As OleDbDataAdapter '''' Change Data Source to the location of Northwind.mdb on your local '''' system. Dim

    文章整理:西部数码--专业提供域名注册虚拟主机服务
    http://www.west263.com
    以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!