Solved

VB.net Error trying to get top 30 rows of query

Posted on 2013-01-20
3
235 Views
Last Modified: 2013-01-20
Hi

I have an app that allows the user to specify any SQL query and the number of records
to pull through. I got the following error trying to run the top 30 records  of:
Select * From Accounting

Incorrect Syntax near the keyword 'From'

Select Top 11 From (Select * From Accounting)"
0
Comment
Question by:murbro
3 Comments
 
LVL 40

Assisted Solution

by:als315
als315 earned 250 total points
ID: 38798008
Here you can find sample with variable: TOP (var)
http://msdn.microsoft.com/ru-ru/library/ms189463.aspx
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 250 total points
ID: 38798021
Why do you have the subquery? It should suffice to do:

Select Top 11 * From Accounting

Nevertheless, you could correct your existing query as:

Select Top 11 * From (Select * From Accounting)
0
 

Author Closing Comment

by:murbro
ID: 38798204
thanks very much
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question