Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2008
    Posts
    6

    Unanswered: How to create DB via DTo

    hai,

    i am new for the pervasive sql. i want to create a new db via DTO. how can i do that. any one can help me.
    thanks.

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    There are two samples on the PErvasive site that show this. They are called
    "VB6 and DTO" and "ODBC & DSN". They are located on the DTO page at http://www.pervasive.com/developerzo...ods/dtidto.asp.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  3. #3
    Join Date
    Sep 2008
    Posts
    6
    thanks for helping me.
    i had pervasive DTO and VB6 one you say. but i am coding using c#. any way i try to do some thing like this. i was able to add a DSN for the existing db.
    but i want to create a new db. i think you can help me. whats wrong with the following code segments.


    dtoResult result=new dtoResult();
    DtoSession My_session = new DtoSession();
    // link with the server
    result = My_session.Connect("SE-1", "", "");
    DtoDatabases databases = new DtoDatabases();

    DtoDatabase my_db=new DtoDatabase();
    databases = My_session.Databases;
    my_db.DdfPath = "D:\\DB FOR IMPORTCOSTING RELEASE VERSION1";
    my_db.DataPath = "D:\\DB FOR IMPORTCOSTING RELEASE VERSION1";
    result = My_session.Databases.Add(my_db, "ABCD");

  4. #4
    Join Date
    Sep 2008
    Posts
    6
    thanks for helping me.
    i had pervasive DTO and VB6 one you say. but i am coding using c#. any way i try to do some thing like this. i was able to add a DSN for the existing db.
    but i want to create a new db. i think you can help me. whats wrong with the following code segments.


    dtoResult result=new dtoResult();
    DtoSession My_session = new DtoSession();
    // link with the server
    result = My_session.Connect("SE-1", "", "");
    DtoDatabases databases = new DtoDatabases();

    DtoDatabase my_db=new DtoDatabase();
    databases = My_session.Databases;
    my_db.DdfPath = "D:\\DB FOR IMPORTCOSTING RELEASE VERSION1";
    my_db.DataPath = "D:\\DB FOR IMPORTCOSTING RELEASE VERSION1";
    result = My_session.Databases.Add(my_db, "ABCD");

  5. #5
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    What behavior are you seeing?
    What is the value of result?
    Is "SE-1", your local machine or is it remote?
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  6. #6
    Join Date
    Sep 2008
    Posts
    6
    Mr Mirtheil

    SE-1 is a local machine. no contain user name and password.

    result is DTOSucess.
    after this , i went to control penal>Administrative tools and Data sources. in the System DSN. ABCD has created. when i double clicked it. i could see a message like this"The database selected for DSN abcd is does not exists. Please select another database"

    when i selected existing database it was ok.


    What i want to do is. i have db files in particular folder. eg. C:\\test\db1 normally we do manually go to the pervasive control center and select new database and link these path as dictionary files. so i could see a new data base with the name.

    so how can i do this via my program.

    result = My_session.Connect("SE-1", "", ""); here result is DTOSucess.

    thanks for helping me.

  7. #7
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    YOu can't just create the DSN. You must also create a Database Name. You use both the dtoDSNs and dtoDatabases. You'll use the Add method in both collections. First, you need to create the database using dtoDatabases.Add and then you use that database in the dtoDSNs.add method.
    Take a look at the VB 6 code I pointed to. It should give you and idea of what needs to be done.
    I don't have any code in C#.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  8. #8
    Join Date
    Sep 2008
    Posts
    6

    Thumbs up How to create a db via dto

    thank you very much mirtheil,

    as you say i got the poin and done. i was able to solve my problem.

    thank you again.

Posting Permissions

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