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
}
}
}