请教:打开数据库时提示:Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 64: {
Line 65: SqlConnection con=DB.createCon();
Line 66: con.Open(); //******报错处******
Line 67: SqlDataAdapter sda= new SqlDataAdapter();
Line 68: sda.SelectCommand=new SqlCommand( "select * from employees ",con);
Source File: d:\c#\asp.net\execise\datagrid.aspx.cs Line: 66
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
LoadLibraryW(UInt16* ) +0
System.EnterpriseServices.Thunk.Security.Init() +76
System.EnterpriseServices.Thunk.Security.SuspendImpersonation() +81
System.EnterpriseServices.Platform.Initialize() +503
System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate cb) +11
System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl) +797
System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControl ctrl) +170
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +358
System.Data.SqlClient.SqlConnection.Open() +384
Execise.DataGrid.BinderToDataGrid() in d:\c#\asp.net\execise\datagrid.aspx.cs:66
Execise.DataGrid.Page_Load(Object sender, EventArgs e) in d:\c#\asp.net\execise\datagrid.aspx.cs:29
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
------解决方案--------------------DB.createCon();
出错了没有返回一个连接.
------解决方案--------------------你电脑是不是装的卡巴6.0.2.621版本,是的话打上 framework1.1的sp1补丁