how to connect to database
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
I want to connect to database with a variable name,,,,,,,,,,,,(test=database name),,,,,,,,,(a(variable)=test),,,,,,,conn=database('test','','')is the method to connect right,,,,,but i want to connect using variable name,,, conn=database('a','',''),,,,because everytimr my datase file will be selected by user,,,,
1 commentaire
Arun Badigannavar
le 22 Nov 2012
Réponses (1)
Titus Edelhofer
le 22 Nov 2012
Hi,
the question is not really clear. Do you mean the following?
a = 'test'; % input from user, e.g., by GUI or input
% use the variable a as database name:
d = database(a, ...);
This works fine as long as the user passes a "known" database name ...
Titus
3 commentaires
Arun Badigannavar
le 23 Nov 2012
Titus Edelhofer
le 23 Nov 2012
The tables are specified when you read data, e.g.
tableName = 'customers';
curs = exec(['SELECT * FROM ' tableName]);
Titus
Arun Badigannavar
le 23 Nov 2012
Cette question est clôturée.
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!