Link to home
Start Free TrialLog in
Avatar of greenbird
greenbird

asked on

Help! How to create a database dynamically??

Hi,

There is a listbox in a dialog, which contains the names of some attributes.

after the user chooses some attributes, i want to create a new databse with these names (the values can be obtained from the old database). Anyone knows how to do that? samples are welcomed!

 Pls Help! I need to solve it urgently!
 Thanks a lot!

Avatar of Zoppo
Zoppo
Flag of Germany image

just listening ...
Avatar of greenbird
greenbird

ASKER

Hi, zoppo,

???? what do u mean huh? can not get it leh...

pls help me!
thanks a lot!
sorry, but I can't help you ...

I just added this comment to be notified when comments/answers are posted, because I'm interested too ... it's usual in EE to do this if one does not have to say anything to a question but wants to know what's going on...

ZOPPO
What will you be using? DAO or ODBC
What database?
MS Access, Oracle.....?????
Hi,

It is Ms Access. i prefer not to use ODBC. that is i want to create a .mdb database at runtime.

thanks a lot!
I am not quite clear what you want.

1. Database can be created dynamically but what kind of database you want to create? Access, ORACLE, Sybase etc.
2. Do you want to use DAO or ODBC? If you have Access, it is preferable to use MFC DAO classes. ODBC otherwise.

Could you describe in detail? This will help us to answer you correctly and fast.

All the best.

Vicky
Sorry. I did not refresh before posting comment.
ASKER CERTIFIED SOLUTION
Avatar of inpras
inpras

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
to copy tamplate U can use CopyFile(.....);
What you want is already there in MSDN sample DaoTable. You can use most of that for your app. Don't waste you time redoing that.
Hi, all,

thanks so much for ur kind help!

i will try it out as inpras said. if got any problem, i will come back here again :)

Thanks a million for all the help!
Hi,

i did not refresh when i post the comment :)

Bapat, is it? i will check DaoTable soon, see whether they are what i want. thanks a lot!
Hi, all,

does anyone know how to get the name from the edit box? that is, i ask the user to enter a name in an edit box, then how do i get the name?

Thanks a lot!
CString strName;
m_edit.GetWindowText(strName);
Hi,

is
database.ExecuteSQL("CREATE TABLE tablename Col1 Prop1, Col2 Prop2");

the syntex correct? it always gives me an error message.

i find in web the SQL command is :

create table table_name (field_type field_name...)
but it also not correct one...

any one know the correct syntex ? or where to look it up in the web?

thanks a  lot!
create table table_name(a varchar2,
b date,c int,
d date)


but watch out
the data types may be diff with diff
databases

you can't use varchar2 in SQl SERVER
or number

you can't use numeric in oracle


hope this helps


niraj