************** 异常文本 **************
System.NullReferenceException: 未将对象引用设置到对象的实例。
在 DB.GetSqlCon() 位置 E:\应用\DormManageSystemfinal\app_code\DB.cs:行号 30
在 DB.GetDataTable(String sql) 位置 E:\应用\DormManageSystemfinal\app_code\DB.cs:行号 73
在 DormManageSystem.AddStudent.comboBox_lou_SelectedIndexChanged(Object sender, EventArgs e) 位置 E:\应用\DormManageSystemfinal\AddStudent.cs:行号 89
在 System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
在 System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
在 System.Windows.Forms.ComboBox.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
F5运行一点错没有 , .exe打开就有错 ,啥情况
System.NullReferenceException: 未将对象引用设置到对象的实例。
在 DB.GetSqlCon() 位置 E:\应用\DormManageSystemfinal\app_code\DB.cs:行号 30
在 DB.GetDataTable(String sql) 位置 E:\应用\DormManageSystemfinal\app_code\DB.cs:行号 73
在 DormManageSystem.AddStudent.comboBox_lou_SelectedIndexChanged(Object sender, EventArgs e) 位置 E:\应用\DormManageSystemfinal\AddStudent.cs:行号 89
在 System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
在 System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
在 System.Windows.Forms.ComboBox.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
F5运行一点错没有 , .exe打开就有错 ,啥情况
解决方案 »
- '>'字元,十六进制值无法包含在名称中
- LINQ探秘:实现一个自己的LINQ Provider
- Visio for Enterprise Architects 支持 Visual Studio 2008 吗?
- 为什么不能返回SQLDataReader和DataSet?
- dataGridView与table添加记录的问题
- 请帮忙一个问题,关于界面登录的问题!!
- C#中 怎样获取xml的命名空间?
- 请教:用ado.net实现listview 数据填充问题
- 如何用C#为实验室机房排课?
- 为什么我的dataGridView不能更新数据和增加新行?
- 关 iframe 的 进人啊 来人救命
- c# 光标离开textbox控件后,自动判断该元器件名称是否已经存在,应该用什么事件?
public static SqlConnection GetSqlCon()
{
string ConString = System.Configuration.ConfigurationManager.ConnectionStrings["dormmanageConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(ConString);
return con;
}
就这个找app.config数据连接阿
<connectionStrings>
<add name="dormmanageConnectionString"
connectionString="Data Source=LBWIN7\SQL2005;Initial Catalog=manage;User ID=sa;Password=123"
providerName="System.Data.SqlClient" />
</connectionStrings>
exe是生成到Debug文件夹阿, config 文件拷进去?那不也没有啊