日期:2014-05-19  浏览次数:20759 次

找高人 关于用C# 编程 !@!!!!!!!!!!!!!!!!!!!!!
我用的是这个   API   函数   public   virtual   new   void   NtAccountCreate   (   System.String   bstrDomain   ,   System.String   bstrUserLogin   ,   System.String   bstrPassword   ,   System.String   bstrUserComment   ,   System.String   bstrLocalGroup   )


using   System;
using   System.Collections;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Web;
using   System.Web.SessionState;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.Web.UI.HtmlControls;
using   MSExchangeAcctLib;
namespace   exchangetest
{
///   <summary>
///   Summary   description   for   WebForm1.
///   </summary>
public   class   WebForm1   :   System.Web.UI.Page
{
protected   System.Web.UI.WebControls.Button   Button1;
public   MSExchangeAcctLib.IAcctMgmt   sd;
             

private   void   Button1_Click(object   sender,   System.EventArgs   e)
{
//sd.NtAccountDelete( "utpcb.com ", "py-wang ");
  sd.NtAccountCreate( "域名 ", "管理员账号 ", "密码 ", "新加的用户 ", "所属的组 ");
TextBox1.Text= "nihao ";

}
 
        private   void   Page_Load(object   sender,   System.EventArgs   e)
{
//   Put   user   code   to   initialize   the   page   here
}

#region   Web   Form   Designer   generated   code
override   protected   void   OnInit(EventArgs   e)
{
//
//   CODEGEN:   This   call   is   required   by   the   ASP.NET   Web   Form   Designer.

InitializeComponent();
base.OnInit(e);
}

///   <summary>
///   Required   method   for   Designer   support   -   do   not   modify
///   the   contents   of   this   method   with   the   code   editor.
///   </summary>
private   void   InitializeComponent()
{        
this.Button1.Click   +=   new   System.EventHandler(this.Button1_Click);
this.Load   +=   new   System.EventHandler(this.Page_Load);

}
#endregion


}
}
我的目的很简单   就是按下BUTTON就能加入我写入的用户名和密码
环境是   WIN2000     2003.NET  
我运行点BUTTON后出现以下错误


Description:   An   unhandled   exception   occurred   during   the   execution   of   the   current   web   request.   Please   review   the   stack   trace   for   more   information   about   the   error   and   where   it   originated   in   the   code.  

Exception   Details:   System.NullReferenceException:   Object   reference   not   set   to   an   instance   of   an   object.

Source   Error:  


Line   24:   {
Line   25:   //sd.NtAccountDelete( "utpcb.co