Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

private async Task<string> getDeviceDescription(int manufacture, string serialNu

ID: 3906439 • Letter: P

Question

private async Task<string> getDeviceDescription(int manufacture, string serialNumber)

{

var output = new sqlParameter("@deviceDescription", sqlDbType.NVarChar, 255) { Direction = ParameterDirection. Output };

await Database.ExecuteSqlCommandAsync("exec storedProcedure @manufacture, @serialNumber, @deviceDescription OUT", new sqlParameter("@manufacture", manufacture), new sqlParameter("@serialNumber", serialNumber), output);

description = (string) output.Value;

return description;

}

I keep getting System.NotSupportedException: A second operation started on this context before a pervious asynchronous operation completed. Use await to ensure that any asynchronous operations have completed. I have a list of devices (100-1000 devices) and I want to get there description. I dont know how to get rid of this error and I noticed not all the descriptions are being shown like it skips some of the devices

Explanation / Answer

Please verify whether all sqlparameters are mentioned properly or not. As you described I hope you are missing some parameters which are mentioned in those device which are missed out. Aactually other device suppose to have null syntax for the same parameter so it is giving output but the device having the same syntax is skipped. verify all parameters are mentioned or not. get the output in csv file and verify sql table whether all syntax mentioned properly.