日期:2014-05-18  浏览次数:20431 次

ASP.NET 怎么样调用下面两个过程?
第一个:

CREATE PROCEDURE UP_admin_Update
@admin varchar(50),
@apwd varchar(50),
@adtime datetime,
@state varchar(50)
 AS 
UPDATE admin SET 
[admin] = @admin,[apwd] = @apwd,[adtime] = @adtime,[state] = @state
WHERE 

GO


第二个:
CREATE PROCEDURE UP_admin_Delete

 AS 
DELETE admin
WHERE 

GO


------解决方案--------------------
帖段函数,自己看看...
C# code

public int MoveDirectory(int nDirID, int nParentID)
    {
        SqlConnection con = DB.createDB();
        int nResult = -1;
        SqlCommand cmd = new SqlCommand("Pr_MoveDirectory",con);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter pDirID = new SqlParameter("@DirID",SqlDbType.Int,4);
        pDirID.Value = nDirID;
        cmd.Parameters.Add(pDirID);
        SqlParameter pParentID = new SqlParameter("@ParentID",SqlDbType.Int,4);
        pParentID.Value = nParentID;
        cmd.Parameters.Add(pParentID);
        try
        {
            con.Open();
            nResult = cmd.ExecuteNonQuery();
        }
        catch (SqlException ex)
        {
            throw new Exception(ex.Message, ex);
        }
        finally
        {
            con.Close();
        }
        return nResult;
    }