机房收费系统总结之7——存储过程
效率是每个人追求的目标,其中在数据库中特别能体现效率的对象就是——存储过程。
将常用的或很复杂的工作,预先用SQL语句写好并用一个指定的名称存储起来,那么以后要叫数据库提供与已定义好的存储过程的功能相同的服务时,只需调用execute,即可自动完成命令。
4.安全性高,可设定只有某此用户才具有对指定存储过程的使用权
这就是存储过程,通过亲自初尝实践,感觉不算很难。嘿嘿!Public Function UpdateAccounts(ByVal enUserInfo As UserInfoEntity) As Integer Implements ISettleAccounts.UpdateAccounts '声明并实例化存储过程 Dim strProc As String = "Proc_SettleAccounts" '声明并实例化参数数据 Dim sqlParams As SqlParameter() = {New SqlParameter("@operateUserName", enUserInfo.UserName), New SqlParameter("@isSettleAccounts", "未结账"), New SqlParameter("@settleAccountsResult", "已结账")} '执行并返回查询结果 Return clsSqlHelper.ExecAddDelUpdate(strProc, CommandType.StoredProcedure, sqlParams)End Function