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
can ping websites but cannot browse
Install, boot Vista errors
Delete Function for single record in ADO has one line returns error
Querying Query Results in VB.NET
How do I take a totals query and update a column in another table?
Uploading image cropping area settings to server side aspx
uninstall this application when it falls out of the scope of managment
How to create a copy of table from one database to another(need schema as well)+sql server 2005
MS SQL 2005 case problem
need to convert the following from asp to asp.net