private void FindInMultiPKey(DataTable myTable){
DataRow foundRow;
// Create an array for the key values to find.
object[]findTheseVals = new object[3];
// Set the values of the keys to find.
findTheseVals[0] = "John";
findTheseVals[1] = "Smith";
findTheseVals[2] = "5 Main St.";
foundRow = myTable.Rows.Find(findTheseVals);
// Display column 1 of the found row.
if(foundRow != null)
Console.WriteLine(foundRow[1]);
}
DataRow foundRow;
// Create an array for the key values to find.
object[]findTheseVals = new object[3];
// Set the values of the keys to find.
findTheseVals[0] = "John";
findTheseVals[1] = "Smith";
findTheseVals[2] = "5 Main St.";
foundRow = myTable.Rows.Find(findTheseVals);
// Display column 1 of the found row.
if(foundRow != null)
Console.WriteLine(foundRow[1]);
}
解决方案 »
- 关于C#的数据库开发方面的问题,有很多不解。。
- 寻installshield 打包高手 付费300元人民币 打包C#.net和Access 要求安装画面美观
- 如何通过断点查找错误
- 在winform中页面之间有哪几种传值的方式!!
- ShowModeDialog()的问题。。。。
- 如果将自己发布的Dll,出现在“添加引用”->“.net”中?而不是直接引用*.dll文件
- 像素与字节的问题
- 问个小问题,听说MS为了推广C#。VS2005是用C#做出来的,是不是真的啊,别BS我哦,我不知道,(20分结贴)
- 如何用SQL语句判断在Access中表是否存在
- 谁有关于c#的电子文档? 提供出来我帮大家整理,
- datagrid问题
- 我通过overide wndproc来截获一些windows消息,如何不让window处理而是让我处理?
DataTable dt=new DataTable("dTable");
DataColumn[] keys = new DataColumn[1];
dt.Columns.Add(new DataColumn("dKeys", typeof(string)));
dt.Columns.Add(new DataColumn("d1", typeof(string)));
dt.Columns.Add(new DataColumn("d2", typeof(string)));keys[0] = dt.Columns["dKeys"];
dt.PrimaryKey = keys;