title: How to use Last() of SQL server in Vb.net
body: <p>Last() is used to retrieve the last record of a column in a table in SQL. And the query "select Last(id) from project", id=column name and project is the table name, is working fine. But when i used this query in VB.net while trying to fetch the last record of a column in a table from the database, it is not recognised. it is Is there any alternative to perform this action?? Its a huge code. this is the part of the code where i get the error:</p>
  
  <pre><code>str = "select Last(id) from details"
   cmd = New SqlCommand(str, con)  //con is the connection which works fine
   adapt = New SqlDataAdapter(cmd) // error here "Last() is not inbuilt function"
   adapt.Fill(ds) 
   i = ds.Tables(0).Rows(0)(1)
   i = i + 1
  </code></pre>