DataRelation设定的问题???

YUAN168 2007-05-28 11:06:18
SqlCommand sqlCmd=new SqlCommand();
sqlCmd.CommandText="P_GetDutyTaskInfo";
sqlCmd.CommandType=CommandType.StoredProcedure ;

dsDutyTask=dataAccess.FillDataSetMasterDetail(dsDutyTask,sqlCmd,"HOD2DUTY","HOD2DUTY_D");

//MessageBox.Show(this.dsDutyTask.Tables[0].Rows[0][0].ToString());
//MessageBox.Show(this.dsDutyTask.Tables[1].Rows[2][0].ToString());
DataRelation duty_rel = dsDutyTask.Relations.Add("les",
this.dsDutyTask.Tables[0].Columns["ID_HOD2DUTY"],
this.dsDutyTask.Tables[1].Columns["ID_DUTY"]);
this.dataGridView1.DataSource = this.dsDutyTask.Tables[0];
this.dataGridView2.DataSource = this.dsDutyTask.Tables[1];
========================================================================
我设定好dataRelation后运行也没问题,
但是当我点DataGridView1中的一行时,Datagridview2中的数据并不会发生改变,为什么?
...全文
173 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
老彭学java 2007-09-04
  • 打赏
  • 举报
回复
问题是怎么解决的啊.
把解决方法说出来啊,这样子就结贴了.没劲
ckpckphaha 2007-05-28
  • 打赏
  • 举报
回复
不懂也要帮楼主顶顶
wuzy1229 2007-05-28
  • 打赏
  • 举报
回复
把 你 的代码全部帖出来,才好查询那里的问题
YUAN168 2007-05-28
  • 打赏
  • 举报
回复
未处理 System.Exception
Message="更新数据失败!"
Source="EIP"
StackTrace:
在 EIP.Class.DataAccess.UpdateMasterDeatil(SqlDataAdapter adapterMaster, SqlDataAdapter adapterDetail, DataSet ds) 位置 C:\Documents and Settings\kyle\桌面\EIP\EIP\Class\DataAccess.cs:行号 104
在 EIP.Frm.frmDutyTask.toolSave_Click(Object sender, EventArgs e) 位置 C:\Documents and Settings\kyle\桌面\EIP\EIP\Frm\frmDutyTask.cs:行号 118
在 System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
在 System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
在 System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
在 System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
在 System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
在 System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ToolStrip.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.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
在 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)
在 EIP.Program.Main() 位置 C:\Documents and Settings\kyle\桌面\EIP\EIP\Program.cs:行号 19
在 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()

110,529

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧