I am trying to fetch the record data/form entry values using form id,
I am getting "System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
" error.
below is my code
@foreach (dynamic record in Library.GetRecordsFromForm("52161654-5db5-4575-8e0c-1b52d50684f1"))
{
foreach (var field in record.RecordFields)
{
<td>@field.Value.ValuesAsString()</td>
}
using (var recordStorage = new RecordStorage())
{
var form = formStorage.GetForm(Guid.Parse("c710cc9e-9117-4103-b5b6-ba3c54a2921a"));
var records = recordStorage.GetAllRecords(form).Where(x => x.UmbracoPageId == Model.Content.Id).ToList();
foreach(var rec in records)
{
<h4>@rec.RecordData</h4>
}
}
trying to fetch record data using form id
Hello Everyone,
I am trying to fetch the record data/form entry values using form id, I am getting "System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first. " error.
below is my code
@foreach (dynamic record in Library.GetRecordsFromForm("52161654-5db5-4575-8e0c-1b52d50684f1")) {
}
![enter image description here][1]
Hi Manasa,
Sorry to hear that you have issues with getting data from your form, when you are using Umbraco Forms.
I have found a similar topic / thread on the form.
See this thread - https://our.umbraco.org/forum/umbraco-forms/78207-working-with-record-data-there-is-already-an-open-datareader-associated
Let me know if this also works for you.
All the best,
/Dennis
Hello Dennis,
Thanks a ton for the solution.However i need to get the data with caption, now i am getting with some guid.can you please help.Thank you in advance.
below is my output and the code
Output: {'7881344b-00d8-4158-e47a-e93eaabf5b90':'No','46639fb7-567f-48b7-d63c-c856b97e9c9d':'Texas','11d9a04b-0406-4132-cc81-cc50be328ec5':'abcdefg'} {'7881344b-00d8-4158-e47a-e93eaabf5b90':'No','46639fb7-567f-48b7-d63c-c856b97e9c9d':'Texas','11d9a04b-0406-4132-cc81-cc50be328ec5':'abcdefg'} {'7881344b-00d8-4158-e47a-e93eaabf5b90':'No','46639fb7-567f-48b7-d63c-c856b97e9c9d':'Texas','11d9a04b-0406-4132-cc81-cc50be328ec5':'abcdefg'}
Goal:
{'state':'No','Location':'Texas','Name':'abcdefg'}
Code:
@{ using (var formStorage = new FormStorage()) {
}
}
Hello
I am trying to use FormStorage but having the error message below:
The type or namespace name 'FormStorage' could not be found (are you missing a using directive or an assembly reference?)
Can you please advise?
thanks
Hi. Missing : using Umbraco.Forms.Data.Storage; I assume. Regards.
Yes that's right thanks.
Hello
I wanted to get the last submitted record id of a form on submit. Can you please advise how can this be done?
Thanks
is working on a reply...