Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

how to connect to database

1 Ansicht (letzte 30 Tage)
Arun Badigannavar
Arun Badigannavar am 22 Nov. 2012
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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 Kommentar
Arun Badigannavar
Arun Badigannavar am 22 Nov. 2012
how to perform this,,,everytime my database will be changing

Antworten (1)

Titus Edelhofer
Titus Edelhofer am 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 Kommentare
Titus Edelhofer
Titus Edelhofer am 23 Nov. 2012
The tables are specified when you read data, e.g.
tableName = 'customers';
curs = exec(['SELECT * FROM ' tableName]);
Titus
Arun Badigannavar
Arun Badigannavar am 23 Nov. 2012
here table is 'customers' ,,,and u r giving it to 'tableName' right?

Diese Frage ist geschlossen.

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by