dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Error accesing to DataBase, where the error is?

  1. #1
    Join Date
    Jan 2007
    Posts
    3

    Arrow Error accesing to DataBase, where the error is?

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

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Error accesing to DataBase, where the error is?

    What 'Data Source' are you using here?
    Code:
    connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\;Extended Properties=Paradox 5.x;";
    - petter

  3. #3
    Join Date
    Jan 2007
    Posts
    3

    Arrow Re: Error accesing to DataBase, where the error is?

    hello wildfrog,
    if I use the ConnectionString:

    connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\articulos.db;Extended Properties=Paradox 5.x;";

    (with the database file included)
    I get the error:

    'C:\articulos.db' no es una ruta de acceso válida. Asegúrese de que la ruta está escrita correctamente y que está conectado al servidor donde se encuentra el archivo.

    what is wrong
    regards, Angel.

  4. #4
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: Error accesing to DataBase, where the error is?

    I did a quick search on Extended Properties, and it looks like it needs to be:

    connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\articulos.db;Extended Properties=\"Paradox 5.x\";";

  5. #5
    Join Date
    Jan 2007
    Posts
    3

    Arrow Re: Error accesing to DataBase, where the error is?

    hello dcell59, I tried that but the problem persist, if you have some other idea, please tell me as soon as possible, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)