SurveyFactoryGet Method |
Namespace: AskiaCore
Retrieves a specific survey and display its name
using AskiaCore; namespace MyApp { public class MyProgram { static void Main() { // Initialize the database connection string (Where the survey was stored) Persistent.InitDatabaseConnection("connectionstring", DatabaseTypes.PORTAL); // Create a new context IContext context = ContextFactory.Create(); context.UserId = 1; context.SessionId = "xxxxx-xxxxx-xxxxx-xxxxxx"; context.LanguageId = 2057; // Edit the survey with this language (English) // Get the survey with the AskiaPortal Id = 1 ISurvey survey = SurveyFactory.Get(context, 1); if (survey == null) { Console.WriteLine("[ERROR] Could not find the survey with the AskiaPortal id 1"); } else { Console.WriteLine("The name of the survey 1 is `{0}`", survey.Name); } // Release the database connection Persistent.EndDatabaseConnection(); } } }