0

I am getting an exception while declaring the local variable in MYSQL. Please suggest me how to solve the issue..

Exception:
Fatal error encountered during command execution.
InnerException:
{"Parameter '@OrderofParent' must be defined."}

Code Snippit:

   StringBuilder sbQuery = new StringBuilder(); <br>
    sbQuery.Append(@"Declare @OrderofParent INT; SET @OrderofParent = 0;
                    select top 1 @OrderofParent = OrderofParent from Filter group        by          OrderofParent order by OrderofParent desc;

    select 'FamilyType' as Mode, 0 as Id, 'Complexity Type' as FilterName, null as FilterCreatedDate, 0 as IsDisabled,0 as ParentId,                                               @OrderofParent as OrderofParent,1 as TagDisplay, 0 as ParentCount from I_FamilyTypePrice
union
Select 'Filter', Id, FilterName, FilterCreatedDate, IsDisabled, f.ParentId, OrderofParent, TagDisplay, 0 from Filter f where f.ParentID = 0 
union
select 'FamilyType', ft.Id, FamilyTypeName, CreatedDate, 0,0, @OrderofParent,0, count(complexityType) from I_FamilyTypePrice ft join Family f on f.complexityType = ft.Id where version = @version and IsActive = 1 and Uploaded = 1; ");
1
  • Where's the code that actually calls mySQL? Commented Feb 7, 2014 at 4:31

1 Answer 1

1

ADD "Allow User Variables=True" in the connection string parameter

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.