如何将parsedArray数据存储到SQL Server数据库?

时间:2019-01-12 18:59:14

标签: c# sql asp.net sql-server asp.net-mvc

我正在通过调用API获取字符串数据。

 JArray parsedArray = JArray.Parse(stringData);
 int i = 1;

 foreach (var item in parsedArray)
 {
     ProjectInformation aProjectInformation = new ProjectInformation();

     string id = (string)item.SelectToken("formid");
     aProjectInformation.FormId = id;

     string projectName = (string)item.SelectToken("title");
     aProjectInformation.ProjectName = projectName;

     string surveyName = (string)item.SelectToken("description");
     aProjectInformation.SurveyName = surveyName;

     string lastSubmissionTime = (string)item.SelectToken("last_submission_time");
     aProjectInformation.LastSubmissionTime = lastSubmissionTime;

     int submissionNumber = (int)item.SelectToken("num_of_submissions");
     aProjectInformation.TotalSubmission = submissionNumber;

     int submissionToday = (int)item.SelectToken("submission_count_for_today");
     aProjectInformation.SubmissionToday = submissionToday;

     aProjectInformation.Serial = i;
     projectList.Add(aProjectInformation);

     i++;
}

如何将ID,项目名称,测量名称,最后提交时间,提交编号,今天的提交,序列号存储到SQL Server数据库的表中?

0 个答案:

没有答案