Active Query Builder support area

ConnectionForm from C#

Avatar
  • updated
  • Completed

Hello - I just purchased Active Query Builder and am getting started. 

The ConnectionForm that is in the BasicDemo is really great. In my application my users can connect to any number of different databases of their choice and the ConnectionForm will work great at allowing them to generate the necessary connection strings.

I plan to save the connection string for each database. If they close the application and come back later, it would be nice if when the ConnectionForm is opened again it could, based on the connection string, show the proper data in the dropdowns, textboxes, etc.  I don't think it seems possible though - or am I missing something?


Thx!

Avatar
Kay Bren

Sounds amazing! Thx for the fast response. I will check it out!

Avatar
Andrey Zavyalov, PM

Hello,

Thank you for your question and for purchasing Active Query Builder.

ConnectionDescriptor classes can restore their state and re-open the editing form connection string.

BaseConnectionDescriptor conDescriptor = new MSSQLConnectionDescriptor() { ConnectionString = "..." };
var container = PropertiesFactory.GetPropertiesContainer(conDescriptor.MetadataProperties);
(propertiesBar as IPropertiesControl).SetProperties(container); // PropertiesBar control 

I recommend reviewing the Full-Featured MDI Demo project. There you can find ready-to-use forms to save and edit connections of different types (ConnectionForm and EditConnectionForm). Look at the SaveData and RestoreData methods in the Misc.cs file, they provide the sample code of saving this data between sessions.