日期:2014-05-18 浏览次数:20528 次
ALTER PROCEDURE p_UpdateTree( @MenuName nvarchar(50), @MenuFather nvarchar(50), @MenuGroup nvarchar(50), @New_MenuName nvarchar(50), @NewMenuAddress char(60), @MenuShow bit, @RValue nvarchar(10) output ) AS SET NOCOUNT ON Update ControlTree Set MenuName=@New_MenuName,MenuAddress=@NewMenuAddress,MenuShow=@MenuShow Where MenuName=@MenuName AND MenuFather=@MenuFather AND MenuGroup= @MenuGroup IF @@ROWCOUNT>0 begin set @RValue='OK' end ELSE begin set @RValue='Failed' end select @RValue GO
Public Function UpdateTree(ByVal MenuName As String, ByVal MenuFather As String, ByVal MenuGroup As String, ByVal New_MenuName As String, ByVal NewMenuAddress As String, ByVal MenuShow As Integer) As Boolean Dim SqlCon As New SqlConnection SqlCon = Consql() Dim SqlComm As New SqlCommand("p_UpdateTree", SqlCon) If SqlCon.State Then Try With SqlComm .CommandType = CommandType.StoredProcedure .Parameters.Add(New SqlParameter("@MenuName", MenuName)) .Parameters.Add(New SqlParameter("@MenuFather", MenuFather)) .Parameters.Add(New SqlParameter("@MenuGroup", MenuGroup)) .Parameters.Add(New SqlParameter("@New_MenuName", New_MenuName)) .Parameters.Add(New SqlParameter("@NewMenuAddress", NewMenuAddress & " ")) .Parameters.Add(New SqlParameter("@MenuShow", MenuShow)) .Parameters.Add(New SqlParameter("@RValue", "5")) .Parameters("@RValue").Direction = ParameterDirection.Output .ExecuteNonQuery() End With Dim i As String i = SqlComm.Parameters("@RValue").Value.ToString.Trim()'这里是用来调试模式看返回值,总是返回空 If String.Equals(SqlComm.Parameters("@RValue").Value.ToString.Trim(), "OK") Then Return True Else Return False End If Catch ex As Exception Finally SqlComm.Dispose() If SqlCon.State Then SqlCon.Close() SqlCon.Dispose() End Try Else HttpContext.Current.Response.Write("打开数据库失败。请与管理员联系!") HttpContext.Current.Response.End() End If