473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

USING NEXTRESULT with MS ACCESS DATABASE

Hi friends, I am trying to use NextResult method while Connecting my console based application with MS Access database but there is an error generated at run timeit says "Syntax error in from Clause" ? help me to figure out the solution please

here is my code

using System;
using System.Data.OleDb;

class OleDbTest{

public static void Main()
{
OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=E:\\db2.MDB");


String stry="SELECT * FROM pets"+"SELECT * FROM emp_test";
OleDbCommand aCommand = new OleDbCommand(stry, aConnection);
try
{
aConnection.Open();

OleDbDataReader aReader = aCommand.ExecuteReader();

Console.WriteLine("This is the returned data from pets table");

do
{
while(aReader.Read())
{
Console.WriteLine("{0}\t{1}\t{2}",aReader.GetInt32 (0),aReader.GetString(1),aReader.GetString(2));
}
Console.WriteLine("{0}\t{1}\t{2}",aReader.GetInt32 (0),aReader.GetString(1),aReader.GetString(2));
}
while(aReader.NextResult());





aReader.Close();


aConnection.Close();
}


catch(OleDbException e)
{
Console.WriteLine("Error: {0}", e.Errors[0].Message);//select * from emp_test
}
}
}
Aug 25 '08 #1
0 660

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: pmud | last post by:
I have an application (ASP.Net using C# ) . I need to read records from the database based on the value entered by the user. Using Data Reader , I can see only one record in text boxes. But how do...
38
by: Remco Groot Beumer | last post by:
Hello, I'm trying to decide if the following situation would be workable: Generate an MS Access Front End (which will run localy on client computers), which will link to a DBMS (SQL server or...
1
by: Matt Alanzo | last post by:
On another newsgroup an Access knowledgable party posted: >You should be able to connect an Access ADP to an existing SQLExpress >database running in SQLS 2000 compatibility mode. The only thing...
8
by: Carl | last post by:
Hi, Using MS Access 2000, is it possible to run a UPDATE or INSERT SQL query using some form of conditional IF THEN ?? for example: SELECT * FROM Books IF EXISTS(Select Books.ID = 1)
6
by: Serious_Practitioner | last post by:
Good day all, and thank you in advance for your help. No - MANY thanks in advance for your help - I know nothing about using databases on Web servers. I am about to discuss a project with a...
3
by: tshad | last post by:
Is there a way to databind a datareader to 2 different dropdownlists? Something like: StoredSearches.DataSource=objCmd.ExecuteReader StoredSearches.DataValueField="SearchID"...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
2
by: Rosco | last post by:
Hello, Quick Overview: I am creating a Windows application using C# and have run across a problem. I’m trying to use a DataGridView in “Bound” mode, but filter the view. I have a database...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.