If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > How to create DB via DTo

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-29-08, 03:49
sanjeewapbss sanjeewapbss is offline
Registered User
 
Join Date: Sep 2008
Posts: 6
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.
Reply With Quote
  #2 (permalink)  
Old 09-29-08, 08:47
mirtheil mirtheil is online now
Registered User
 
Join Date: Dec 2001
Posts: 1,015
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.
Reply With Quote
  #3 (permalink)  
Old 09-30-08, 01:08
sanjeewapbss sanjeewapbss is offline
Registered User
 
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");
Reply With Quote
  #4 (permalink)  
Old 09-30-08, 03:55
sanjeewapbss sanjeewapbss is offline
Registered User
 
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");
Reply With Quote
  #5 (permalink)  
Old 09-30-08, 08:48
mirtheil mirtheil is online now
Registered User
 
Join Date: Dec 2001
Posts: 1,015
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.
Reply With Quote
  #6 (permalink)  
Old 10-01-08, 02:23
sanjeewapbss sanjeewapbss is offline
Registered User
 
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.
Reply With Quote
  #7 (permalink)  
Old 10-01-08, 08:55
mirtheil mirtheil is online now
Registered User
 
Join Date: Dec 2001
Posts: 1,015
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.
Reply With Quote
  #8 (permalink)  
Old 10-02-08, 08:13
sanjeewapbss sanjeewapbss is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On