angelherriv
January 24th, 2007, 07:14 PM
//Hello folks, I have the following problem to access to a Paradox database, I don't know why,
//all seems to be correct, I have two databases, the first one belongs to MS Access, and the
//second one belongs to Paradox (.db). If I use the first ConnectionString the getDataTable(...)
//method can fill the dataTable object, but if I use the second ConnectionString an error is raised.
//Can somebody helpme, where the error is?,
//Note:
//...both files articulos.db and articulos.mdb are located at "C:\"
//...you can download these database files from:
//http://myfiles.hollosite.com/articulos.zip
//thanks in advance, Angel.
//If you like yo can use a Console Application to test the code
//---beginning-of-code---------
using System;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
namespace dbTest
{
class Program
{
static void Main(string[] args)
{
string connString;
connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\articulos.mdb";
//uncomment the following line to see the runtime error
connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\;Extended Properties=Paradox 5.x;";
//Unexpected error from external database driver (11010)
DataTable dt = DataBaseUtilities.getDataTable(connString);
}
}
public class DataBaseUtilities
{
public static DataTable getDataTable(string connString)
{
DataTable dataTable = new DataTable();
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = connString;
string command = "SELECT * FROM articulos";
OleDbDataAdapter adapter = new OleDbDataAdapter(command, connection);
adapter.Fill(dataTable);
return dataTable;
}
}
}
//---end-of-code---------------
//all seems to be correct, I have two databases, the first one belongs to MS Access, and the
//second one belongs to Paradox (.db). If I use the first ConnectionString the getDataTable(...)
//method can fill the dataTable object, but if I use the second ConnectionString an error is raised.
//Can somebody helpme, where the error is?,
//Note:
//...both files articulos.db and articulos.mdb are located at "C:\"
//...you can download these database files from:
//http://myfiles.hollosite.com/articulos.zip
//thanks in advance, Angel.
//If you like yo can use a Console Application to test the code
//---beginning-of-code---------
using System;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
namespace dbTest
{
class Program
{
static void Main(string[] args)
{
string connString;
connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\articulos.mdb";
//uncomment the following line to see the runtime error
connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\;Extended Properties=Paradox 5.x;";
//Unexpected error from external database driver (11010)
DataTable dt = DataBaseUtilities.getDataTable(connString);
}
}
public class DataBaseUtilities
{
public static DataTable getDataTable(string connString)
{
DataTable dataTable = new DataTable();
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = connString;
string command = "SELECT * FROM articulos";
OleDbDataAdapter adapter = new OleDbDataAdapter(command, connection);
adapter.Fill(dataTable);
return dataTable;
}
}
}
//---end-of-code---------------