Save User Response to Microsoft SQL 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 SqlSurveyResponseRepository:

SurveyResponse resp = BuildYouResponse();

SqlSurveyResponseRepositoryrep = new SqlSurveyResponseRepository("Server=www.mentorlogic.com;
Database=TestDatabase;User Id=user;Password=pass");
rep.Save(resp);
To get the survey object using SqlSurveyResponseRepositoryrep . The following example retrieve a survey with ID = 'ML-546-187'

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

See Also