Click here to Skip to main content
13,094,983 members (84,277 online)
Rate this:
Please Sign up or sign in to vote.
See more:
string query1st = "SELECT * FROM Registration_Master ";
                     com = new SqlCommand(query1st, con);
                     com.CommandType = CommandType.Text;
                     SqlDataAdapter da = new SqlDataAdapter(com);
                     DataTable dt1st = new DataTable();
                     if (dt1st.Rows.Count>0)


but this gives me wrong output

[Edit]Code block added[/Edit]
Posted 16-Nov-12 5:35am
Updated 16-Nov-12 5:36am
Mathlab 16-Nov-12 11:39am
Oracle, MYSQL or MSSQL?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

SELECT TOP 1 * FROM Registration_Master

ORACLE (source[^])
If you want just a first selected row you can:
select fname from MyTbl where rownum = 1

you can also use analytic functions to order and take the top x
select max(fname) over (rank() order by some_factor) from MyTbl

SELECT * FROM Registration_Master LIMIT 1;

If you want the latest record however, in each case you will have to order your records based on your primary key descending(or other column that can be sorted to provide the latest record)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100