当前位置:编程学习 > C#/ASP.NET >>

C#调试出错,帮忙解决一下

未处理 System.ArgumentException
  Message="项“attachdbfilename”的值无效。"
  Source="System.Data"
  StackTrace:
       在 System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup)
       在 System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
       在 System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
       在 System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
       在 System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value)
       在 System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
       在 Myschool.MySchool1DataSetTableAdapters.StudentMsgTableAdapter.InitConnection() 位置 D:\作业\jiaowu\Myschool\Myschool\MySchool1DataSet.Designer.cs:行号 801
       在 Myschool.MySchool1DataSetTableAdapters.StudentMsgTableAdapter.get_Connection() 位置 D:\作业\jiaowu\Myschool\Myschool\MySchool1DataSet.Designer.cs:行号 694
       在 Myschool.MySchool1DataSetTableAdapters.StudentMsgTableAdapter.InitAdapter() 位置 D:\作业\jiaowu\Myschool\Myschool\MySchool1DataSet.Designer.cs:行号 751
       在 Myschool.MySchool1DataSetTableAdapters.StudentMsgTableAdapter.get_Adapter() 位置 D:\作业\jiaowu\Myschool\Myschool\MySchool1DataSet.Designer.cs:行号 684
       在 Myschool.MySchool1DataSetTableAdapters.StudentMsgTableAdapter.Fill(StudentMsgDataTable dataTable) 位置 D:\作业\jiaowu\Myschool\Myschool\MySchool1DataSet.Designer.cs:行号 818
       在 Myschool.StudentFrm.StudentFrm_Load(Object sender, EventArgs e) 位置 D:\作业\jiaowu\Myschool\Myschool\StudentFrm.cs:行号 21
       在 System.Windows.Forms.Form.OnLoad(EventArgs e)
       在 System.Windows.Forms.Form.OnCreateControl()
       在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       在 System.Windows.Forms.Control.CreateControl()
       在 System.Windows.Forms.Control.WmShowWindow(Message& m)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
       在 System.Windows.Forms.Form.WmShowWindow(Message& m)
       在 System.Windows.Forms.Form.WndProc(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       在 System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       在 System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       在 System.Windows.Forms.Control.set_Visible(Boolean value)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.Run(Form mainForm)
       在 Myschool.Program.Main() 位置 D:\作业\jiaowu\Myschool\Myschool\Program.cs:行号 17
       在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
--------------------编程问答-------------------- 检查attachdbfilename值
看看StudentFrm.cs --------------------编程问答-------------------- 你的connectionString格式不正确,把链接字符串贴出来看看 --------------------编程问答-------------------- ArgumentException 是参数错误啊。你看你是哪个方法出错了。具体定位到那个方法。这样比较好解决问题
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,