关于子集取数据的问题。UP也有分! 通过ds.Relations[0].ChildTable. 不能访问吗?如得到行ds.Relations[0].ChildTable.Rows[i] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我只是想得到子表中的数据,现在是得到了,但当我更换父表中的记录时就发生了错误。现在他还是傻呼呼的去给我取第一个记录.也就是说,当更换的时候我还是无法得到我想要的哪一行代码如下:int curow=dataGrid2.CurrentCell.RowNumber;//得到当前行数DataRow data= this.dataSet11.Relations[0].ChildTable.Rows[curow];string str=data["foodname1"].ToString();MessageBox.Show(str);其实我也知道我错在那里了。就是写注释的哪一行,我不该用dataGrid2的当前行数去指定数据库里的行数可是不这样做我该怎么做呢? 用前台脚本可以获得,很难表达清楚,提醒一下吧,grid在前台被解释为《table》标签,所以取得你要的行的rows.cells[……]就可以了,下面是给grid的行添加前台事件的代码,你应该用的着---------------------------------- if( e.Item.ItemIndex != -1 ) { e.Item.Attributes.Add("onmouseover", "this.bgColor='#C1D2EE'"); e.Item.Attributes.Add("onclick", "document.all.myBox.innerText=this.cells[1].innerText;");//document.all.form1.city.value=this.cells[0].innerText;"); if (e.Item.ItemIndex % 2 == 0 ) { e.Item.Attributes.Add("bgcolor", "#FFFFFF"); e.Item.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('myGrid').getAttribute('singleValue')"); } else { e.Item.Attributes.Add("bgcolor", "oldlace"); e.Item.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('myGrid').getAttribute('oldValue')"); } } 一个简单的WINFORM信息发布系统,请大家指点下思路和大概需要用到的控件 C#程序的运行问题 如何实现Image和Byte的转换? 卡在C#调用C写的DLL传递指针?请教高手 这个函数中的参数是什么类型的?参数如何传递的? 关于c#中excel的调用 如何打开一个新的窗口,关闭一个窗口? 打印 复杂字符串如何处理 后台方式调用一个.asp或.aspx文件 c#中的工程属性是DLL现在我想用运行调试他,应该怎样 Split("\"")拆分字符串不可以么/?
现在他还是傻呼呼的去给我取第一个记录.也就是说,当更换的时候我还是无法得到我想要的哪一行
代码如下:
int curow=dataGrid2.CurrentCell.RowNumber;//得到当前行数
DataRow data= this.dataSet11.Relations[0].ChildTable.Rows[curow];
string str=data["foodname1"].ToString();
MessageBox.Show(str);其实我也知道我错在那里了。就是写注释的哪一行,
我不该用dataGrid2的当前行数去指定数据库里的行数可是不这样做我该怎么做呢?
----------------------------------
if( e.Item.ItemIndex != -1 )
{
e.Item.Attributes.Add("onmouseover", "this.bgColor='#C1D2EE'");
e.Item.Attributes.Add("onclick",
"document.all.myBox.innerText=this.cells[1].innerText;");//document.all.form1.city.value=this.cells[0].innerText;");
if (e.Item.ItemIndex % 2 == 0 )
{
e.Item.Attributes.Add("bgcolor", "#FFFFFF");
e.Item.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('myGrid').getAttribute('singleValue')");
}
else
{
e.Item.Attributes.Add("bgcolor", "oldlace");
e.Item.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('myGrid').getAttribute('oldValue')");
}
}