1
Automation Interface, Add-Ins and Tools / Re: Get the name of the db of the current project
« on: September 16, 2015, 03:10:03 am »
Hi guys!
I was working in another thing and suddenly a good idea about this problem appear in my mind. I think that maybe the problem of the query was the name of the return field.
The query was "SELECT DATABASE() FROM DUAL". So I changed for something as simple as "SELECT DATABASE() AS id FROM DUAL" and.... WORKS!!! ^^
Something really stupid yes, but the thing is that now works.
The complete code to obtain the name of the database (in mysql) where is connected the current EA project (if it's connected of course) is:
Anyway thanks a lot for your help.
I was working in another thing and suddenly a good idea about this problem appear in my mind. I think that maybe the problem of the query was the name of the return field.
The query was "SELECT DATABASE() FROM DUAL". So I changed for something as simple as "SELECT DATABASE() AS id FROM DUAL" and.... WORKS!!! ^^
Something really stupid yes, but the thing is that now works.
The complete code to obtain the name of the database (in mysql) where is connected the current EA project (if it's connected of course) is:
Code: [Select]
string sql = "SELECT DATABASE() AS id FROM DUAL;";
string xml = repository.SQLQuery(sql);
XmlDocument response = new XmlDocument();
response.LoadXml(xml);
XmlNodeList node = response.GetElementsByTagName("id");
string nameOfDatabase = node.Item(0).InnerText;
Anyway thanks a lot for your help.
