扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:天极网 2007年11月5日
关键字:
CREATE PROCEDURE [dbo].[TitlesPerPublisher] AS Begin SELECT Pub_Id, Title, Price FROM Titles SELECT Pub_ID, Pub_Name FROM Publishers End |
CommandType.StoredProcedure : daHDAta = new SqlDataAdapter(sSQLCmd, cnstring) dahData.SelectCommand.CommandType = CommandType.StoredProcedure |
public void Add(DataRelation); public virtual DataRelation Add(DataColumn, DataColumn); public virtual DataRelation Add(DataColumn[], DataColumn[]); public virtual DataRelation Add(string, DataColumn, DataColumn); public virtual DataRelation Add(string, DataColumn[], DataColumn[]); public virtual DataRelation Add(string, DataColumn, DataColumn, bool); public virtual DataRelation Add(string, DataColumn[], DataColumn[], bool); |
dsTest.Relations.Add("PubTitles", dsTest.Tables["Publishers"].Columns["Pub_ID"], dsTest.Tables["Titles"].Columns["Pub_ID"]) |
public DataRow[] GetChildRows(DataRelation); public DataRow[] GetChildRows(string); public DataRow[] GetChildRows(DataRelation, DataRowVersion); public DataRow[] GetChildRows(string, DataRowVersion); |
foreach(DataRow drPublisher in dtPublishers.Rows) { Console.WriteLine(drPublisher["Pub_Id"] + "\t" + drPublisher["Pub_Name"]); Console.WriteLine("====================="); foreach(DataRow drTitle in drPublisher.GetChildRows("PubTitles")) { Console.Write(drTitle["Title"] + "\t"); Console.Write((drTitle["price"].ToString() != null ? drTitle["price"] : "n/a")); } } |
DataRelation drPubsTitles = dsHData.Relations.Add("PubTitles", dtPublishers.Columns["Pub_ID"], dsHData.Tables["Titles"].Columns["Pub_ID"]); foreach(DataRow drPublisher in dtPublishers.Rows) { Console.WriteLine(drPublisher["Pub_Id"] + "\t" + drPublisher["Pub_Name"]); Console.WriteLine("====================="); foreach(DataRow drTitle in drPublisher.GetChildRows(drPubsTitles)) { Console.Write(drTitle["Title"] + "\t"); Console.Write((drTitle["price"].ToString() != null ? drTitle["price"] : "n/a")); } } |
public class DataView : MarshalByValueComponent, IBindingList, IList, ICollection, IEnumerable, ITypedList, ISupportInitialize |
dtPublishers.DefaultView.RowFilter="Pub_ID < 2000"; |
dtPublishers.DefaultView.Sort="PUB_ID Desc"; |
foreach(DataRow drPublisher in dtPublishers.Rows) { Console.WriteLine(drPublisher["Pub_Id"] + "\t" + drPublisher["Pub_Name"]); Console.WriteLine("====================="); foreach(DataRow drTitle in drPublisher.GetChildRows("PubTitles")) { Console.Write(drTitle["Title"] + "\t"); Console.Write((drTitle["price"].ToString() != null ? drTitle["price"] : "n/a")); } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者