Save Survey in Microsoft SQL Server Database


You can save the surveys to Microsoft SQL database with a structured data tables using ZSURVEY Repositories APIs. By saving the surveys in a database, you can easily do advanced reporting and data analysis on both surveys and user responses.

Before starting, you need to make sure that you have created ZSURVEY database in your Microsoft SQL server instance. The database creation script for ZSURVEY exists in the software package under "Database" folder. Run this script in your Microsoft SQL Server before proceeding with the next steps.

To save the survey response object using SqlSurveyRepository:


Survey survey= BuildYouSurvey();

SqlSurveyRepository = new SqlSurveyRepository("Server=www.mentorlogic.com;
Database=TestDatabase;User Id=user;Password=pass");
rep.Save(survey);

To get the survey object using SqlSurveyRepository. The following example retrieve a survey with ID = 'ML-546-187'


SqlSurveyRepository rep = new SqlSurveyRepository("Server=www.mentorlogic.com;
Database=TestDatabase;User Id=user;Password=pass");
Survey survey = rep.Get('ML-546-187');

See Also