Microsoft
Software
Hardware
Network
Question : How to SElect only Top row from datatable
I am selecting rows from a datatable - my selection returns multiple rows, but I only wawnt the first one. I am using a try vcatch with a break to kill the loop after the first row (I am importing the rows into another table that has unique constraint that prevents additional rows being imported)
How can I use the SQL statement such as "Select Top 1 ActivityID" in a Datatable SElect?
foreach (DataRow cRow in dsCertifications.Tables[0]
.Rows)
{
int findme = int.Parse(cRow[1].ToString
());
DataRow[] foundrow = dtTranscript.Select("Activ
ityID="+fi
ndme, "EndDate DESC");
if (foundrow != null)
{
foreach (DataRow found in foundrow)
{
try
{
dtRegCerts.ImportRow(found
);
}
catch
{
break;
}
}
}
}
Answer : How to SElect only Top row from datatable
foundrow[0] wil give the first row..
-Ajitha
Random Solutions
How to Set Default Domain Controller? SBS 2003 / Exchange 2007
"net use" shows a drive share as "unavailable" when run from the scheduler
tried to upgrade to svc pk 3, now it won't boot
Restrict Textbox to Number and Decimal character only
VBA - Business Objects Interaction
Strategy for Interpreting Questionnaire Responses on Report
SelectSingleNode question
Windows SharePoint Services Search Required on Farm, not running Stopping
VB program connecting to Access DB - arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
HOW DO OVERRIDE EVENT OF COMBOX IN VBNET