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
Search for a string in all tables.
Strange errors when compiling and OpenGL program
Windows 7 Software Restriction Policy not working.
SSIS question
MS Access VBA - Process Bar
SBS Shutting itself down! It says I have multiple domain controllers when I don't!
Dell Latitude D630 - battery is not recognized in Windows or BIOS
Computer Keeps On Giving Me "c000021a Fatal System Error" Whenever I Try To Log On
Installing .NET Framework 3.5 errors
SQL GROUP BY Results