错误代码为:
Server Error in '/test' Application.
--------------------------------------------------------------------------------Method not found: Void System.Threading.WaitCallback..ctor(System.Object, IntPtr). 
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.MissingMethodException: Method not found: Void System.Threading.WaitCallback..ctor(System.Object, IntPtr).Source Error: 
Line 66: 
Line 67:  SqlCommand cmd=new SqlCommand("select * from id",DbConn); 
Line 68:  DbConn.Open();
Line 69:      SqlDataReader DR=cmd.ExecuteReader( CommandBehavior.CloseConnection );
Line 70:  DR.Read();
 Source File: e:\web\weba\test\webform1.aspx.cs    Line: 68 Stack Trace: 
[MissingMethodException: Method not found: Void System.Threading.WaitCallback..ctor(System.Object, IntPtr).]
   System.Data.SqlClient.SqlConnection.Open() +761
   test.WebForm1.Button1_Click(Object sender, EventArgs e) in e:\web\weba\test\webform1.aspx.cs:68
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +660 

解决方案 »

  1.   

    错误信息?
    try:
    SqlConnection DbConn=new SqlConnection("data source=pe;initial catalog=test;persist security info=False;user id=sa;workstation id=pe;packet size=4096"); 

    SqlCommand cmd=new SqlCommand("select * from a",DbConn); 
    cmd.Connection.Open();
    ...
      

  2.   

    try like this
    DbConn=new SqlConnection("data source=pe;initial catalog=test;persist security info=False;user id=sa;workstation id=pe;packet size=4096"); 
    DbConn.Open();

    SqlCommand cmd=new SqlCommand("select * from a",DbConn); 
      

  3.   

    to hgknight(江雨):
    连接串无误,数据库没问题!
      

  4.   

    你使用最简单的连接方法看:
    "Data Source=pe;database=test;user id=sa"
      

  5.   

    加上这一句试试
    DbConn.Provider = "SQLOleDb"
    如果你是sqlserver的话
      

  6.   

    Data Source=pe;database=test;user id=sa;password=...