Queryable Collections

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2008
Posts: 72
Reputation: cmhampton is an unknown quantity at this point 
Solved Threads: 10
cmhampton's Avatar
cmhampton cmhampton is offline Offline
Junior Poster in Training

Queryable Collections

 
0
  #1
Mar 6th, 2008
Does anyone know how to create queryable collections in VB without using LINQ? I am working on creating a dynamic questionnaire system and need some help. Here's some background:

The system needs to support parent/child questionnaires. I have the database model created, as well as a query that returns all the questions for a group of questionnaires, sorted and grouped, first by the questionnaire sort order, and then by the question sort order.

Example:

questionid, questionName, questionType, questionOrder, questionnaireOrder, questionnaireid
1, Favorite Color, Dropdown, 100, 100, 3
2, Zip Code, TextBox, 200, 100, 3
3, Email, TextBox, 100, 200, 4

I have a question class, with a collection of answers. The questionnaire class has a collection of the questions.

On the output control, I want to be able to loop through the child questionnaires, and then query the collection to get only the questions associated with the current child questionnaire.

I know this can be done with LINQ, but my company is still on VB8, so I don't have that as an option.

Here's what I am doing now:

  1. 'Get the questions from the questionnaire
  2. Dim dsQuestions As New AppName.BLL.Questionnaires.QuestionCollection
  3.  
  4. 'If this questionnaire is a parent of other questionnaires, get the ParentChildQuestions Collection
  5. If Me.ParentChildQuestions.Count > 0 Then
  6. dsQuestions = Me.ParentChildQuestions
  7. Else
  8. dsQuestions = Me.Questions
  9. End If
  10.  
  11. 'Loop through the questions
  12. For Each q As AppName.BLL.Questionnaires.Question In dsQuestions
  13.  
  14. 'If this is a parent/child questionnaire, and this is a new section, create the section header
  15. If Me.ParentChildQuestions.Count > 0 And (Not q.Questionnaireid = questionnaireid) Then
  16. CreateChildQuestionnaireElement(...)
  17. End If
  18.  
  19. 'Update the questionnaireid variable
  20. questionnaireid = q.Questionnaireid
  21.  
  22. 'Do a whole bunch of crap to output the questions
  23.  
  24. Next

I don't really like this method because it's too many steps and just seems inefficient.

What I would like to do is something like this:

  1. Dim dsChildren As New AppName.BLL.Questionnaire.ChildCollection
  2. dsChildren = questionnaireDataService.GetChildren(_Questionnaireid)
  3.  
  4. For Each child As AppName.BLL.Questionnaire.Child In dsChildren
  5. CreateChildQuestionnaireElement(...)
  6.  
  7. 'Query questions collection to get the questions for this specific child
  8.  
  9. Next
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Queryable Collections

 
0
  #2
Mar 6th, 2008
The problem with this is that a querystring can only hold so many characters. Want to see how many? Type as many as you can inside the address bar and response.write your querystring. You'll see how many. (Not sure if it's 100 or 255).

So most likely... no. However, you can pass them through a cookie if you wish, or a session variable, or even put it in a text file then read it off.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 72
Reputation: cmhampton is an unknown quantity at this point 
Solved Threads: 10
cmhampton's Avatar
cmhampton cmhampton is offline Offline
Junior Poster in Training

Re: Queryable Collections

 
0
  #3
Mar 7th, 2008
Originally Posted by SheSaidImaPregy View Post
The problem with this is that a querystring can only hold so many characters. Want to see how many? Type as many as you can inside the address bar and response.write your querystring. You'll see how many. (Not sure if it's 100 or 255).

So most likely... no. However, you can pass them through a cookie if you wish, or a session variable, or even put it in a text file then read it off.
Was this supposed to be in another thread? My question has nothing to do with query strings.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Queryable Collections

 
0
  #4
Mar 7th, 2008
Question real quick.. then I can help you (it will be in RED).

An no, it was meant for this thread, however I didn't read your thread, just the header. My apologies.
'Get the questions from the questionnaire
Dim dsQuestions As New AppName.BLL.Questionnaires.QuestionCollection

'Is this entire thing in another loop?
'If this questionnaire is a parent of other questionnaires, get the ParentChildQuestions Collection
If Me.ParentChildQuestions.Count > 0 Then
  dsQuestions = Me.ParentChildQuestions
Else
'Does this part matter? It seems like it doesn't, and you only
'choose the above line later on anyway.
  dsQuestions = Me.Questions
End If

'Loop through the questions
For Each q As AppName.BLL.Questionnaires.Question In dsQuestions

'If this is a parent/child questionnaire, and this is a new section, create the section header
If Me.ParentChildQuestions.Count > 0 And (Not q.Questionnaireid = questionnaireid) Then
  CreateChildQuestionnaireElement(...)
End If

'Update the questionnaireid variable
questionnaireid = q.Questionnaireid

'Do a whole bunch of crap to output the questions

Next
This is what I would do. Let me know if I am missing something that I should know:
  1. Dim dsQuestions As New AppName.BLL.Questionnaires.QuestionCollection
  2.  
  3. If Me.ParentChildQuestions.Count > 0 Then
  4. dsQuestions = Me.ParentChildQuestions
  5.  
  6. For Each q As AppName.BLL.Questionnaires.Question In dsQuestions
  7. If Not q.Questionnaireid = questionnaireid Then CreateChildQuestionnaireElement(...)
  8.  
  9. questionnaireid = q.Questionnaireid
  10.  
  11. '........... more code
  12. Next
  13. End If
  14.  
However, like I said, you might have more here that depends on that previous code. Which then, this example would not work.

Why not do it like this also?
  1. 'create a parent collections
  2. Dim dsQuestions As New AppName.BLL.Questionnaires.QuestionCollection
  3.  
  4. If Me.ParentChildQuestions.Count > 0 Then
  5. dsQuestions = Me.ParentChildQuestions
  6.  
  7. For Each q As AppName.BLL.Questionnaires.Question In dsQuestions
  8. If Not q.Questionnaireid = questionnaireid Then
  9.  
  10. 'create a child collections for each parent.
  11. For Each subq As .... (array or collections)
  12.  
  13. 'Either create an array or directly create your child elements
  14. 'Dim arr = From rec In subq CreateChildQuestionnaireElement(...)
  15. 'For Each elemnt In arr
  16. 'write your ChildQUestionnaireElement
  17. 'Next
  18.  
  19. CreateChildQuestionnaireElement(...)
  20. Next
  21.  
  22. questionnaireid = q.Questionnaireid
  23.  
  24. '........... more code
  25. Next
  26. End If
Unless you wish to post the whole code, I think this is about as much as I can help.

Also, quickie question, how do you specify the language you're writing in the code blocks? Been searching for it here. I only saw it when I first joined.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 72
Reputation: cmhampton is an unknown quantity at this point 
Solved Threads: 10
cmhampton's Avatar
cmhampton cmhampton is offline Offline
Junior Poster in Training

Re: Queryable Collections

 
0
  #5
Mar 7th, 2008
Here's the whole function:

  1. 'Create default xml objects
  2. Dim xmlQuestionnaireData As New XmlDocument()
  3. Dim elForm As XmlElement
  4. Dim elPage As XmlElement
  5. Dim elPages As XmlElement
  6. Dim elQuestionnaire As XmlElement
  7. Dim elFields As XmlElement
  8.  
  9. Dim questionnaireid As Integer = 0
  10.  
  11. 'Create the xml header.
  12. xmlQuestionnaireData.AppendChild(xmlQuestionnaireData.CreateXmlDeclaration("1.0", "utf-8", Nothing))
  13.  
  14. 'Add the base elements.
  15. elForm = xmlQuestionnaireData.CreateElement("FORM")
  16. elPages = xmlQuestionnaireData.CreateElement("PAGES")
  17. elPage = xmlQuestionnaireData.CreateElement("PAGE")
  18.  
  19. 'Add the questionnaire name and page info...
  20. elPage.Attributes.Append(xmlQuestionnaireData.CreateAttribute("title")).Value = _QuestionnaireName
  21. elPage.Attributes.Append(xmlQuestionnaireData.CreateAttribute("id")).Value = "Page_1"
  22.  
  23. 'Create the element for the intro text.
  24. elQuestionnaire = xmlQuestionnaireData.CreateElement("INFO")
  25. elQuestionnaire.InnerText = _introText
  26. elPage.AppendChild(elQuestionnaire)
  27.  
  28. 'Create the container for the questions
  29. elFields = xmlQuestionnaireData.CreateElement("FIELDS")
  30.  
  31. 'Get the questions from the questionnaire
  32. Dim dsQuestions As New App.BLL.Questionnaires.QuestionCollection
  33.  
  34. 'If this questionnaire is a parent of other questionnaires, get the ParentChildQuestions Collection
  35. If Me.ParentChildQuestions.Count > 0 Then
  36. dsQuestions = Me.ParentChildQuestions
  37. Else
  38. dsQuestions = Me.Questions
  39. End If
  40.  
  41. 'Create objects for the question
  42. Dim elFieldElement As XmlNode
  43. Dim elPropertiesElement As XmlNode
  44. Dim elPropertyElement As XmlNode
  45.  
  46. Dim questionnaireDataService As New App.DAL.Questionnaire.QuestionnaireDataService()
  47.  
  48. Dim dsChildren As New DataSet
  49. dsChildren = questionnaireDataService.GetChildren(_Questionnaireid)
  50.  
  51. 'Loop through the questions
  52. For Each q As App.BLL.Questionnaires.Question In dsQuestions
  53.  
  54. 'If this is a parent/child questionnaire, and this is a new section, create the section header
  55. If Me.ParentChildQuestions.Count > 0 And (Not q.Questionnaireid = questionnaireid) Then
  56. CreateChildQuestionnaireElement(xmlQuestionnaireData, elFieldElement, elFields, elPropertiesElement, elPropertyElement, q.Questionnaireid)
  57. End If
  58.  
  59. 'Update the questionnaireid variable
  60. questionnaireid = q.Questionnaireid
  61.  
  62. 'Create the base element for this question
  63. elFieldElement = xmlQuestionnaireData.CreateElement("FIELD")
  64.  
  65. 'Create the attributes for the field element
  66. elFieldElement.Attributes.Append(xmlQuestionnaireData.CreateAttribute("id")).Value = q.Questionid
  67. elFieldElement.Attributes.Append(xmlQuestionnaireData.CreateAttribute("label")).Value = q.Question
  68. elFieldElement.Attributes.Append(xmlQuestionnaireData.CreateAttribute("required")).Value = q.Required
  69. elFieldElement.Attributes.Append(xmlQuestionnaireData.CreateAttribute("type")).Value = q.ControlType
  70.  
  71. 'Create the validation types and pass the regular expressions
  72. If q.ValidationType = "Date" Then
  73. CreateValidationDate(xmlQuestionnaireData, elFieldElement, q)
  74. ElseIf q.ValidationType = "Currency" Then
  75. CreateValidationCurrency(xmlQuestionnaireData, elFieldElement, q)
  76. ElseIf q.ValidationType = "Numeric" Then
  77. CreateValidationNumeric(xmlQuestionnaireData, elFieldElement, q)
  78. ElseIf q.ValidationType = "Email" Then
  79. CreateValidationEmail(xmlQuestionnaireData, elFieldElement, q)
  80. ElseIf q.ValidationType = "Password" Then
  81. CreateValidationPassword(xmlQuestionnaireData, elFieldElement, q)
  82. ElseIf q.ValidationType = "URL" Then
  83. CreateValidationURL(xmlQuestionnaireData, elFieldElement, q)
  84. ElseIf q.ValidationType = "Phone" Then
  85. CreateValidationPhone(xmlQuestionnaireData, elFieldElement, q)
  86. ElseIf q.ValidationType = "Zip" Then
  87. CreateValidationZip(xmlQuestionnaireData, elFieldElement, q)
  88. End If
  89.  
  90. 'Add the element to the document
  91. elFields.AppendChild(elFieldElement)
  92.  
  93. 'Create elements for the question properties
  94. elPropertiesElement = xmlQuestionnaireData.CreateElement("PROPERTIES")
  95. elPropertyElement = xmlQuestionnaireData.CreateElement("PROPERTY")
  96.  
  97. 'Question name in HTML
  98. elPropertyElement.Attributes.Append(xmlQuestionnaireData.CreateAttribute("name")).Value = "ID"
  99. elPropertyElement.InnerText = "questionid_" & q.Questionid.ToString()
  100.  
  101. 'Add the element
  102. elPropertiesElement.AppendChild(elPropertyElement)
  103.  
  104. 'Create special properties for different question types. Each type can have a seperate CSS class.
  105. If (q.QuestionType = "Text Box") Then
  106.  
  107. CreatePropertiesTextBox(...)
  108.  
  109. ElseIf q.QuestionType = "Password" Then
  110.  
  111. CreatePropertiesPassword(...)
  112.  
  113. ElseIf q.QuestionType = "Text Area" Then
  114.  
  115. CreatePropertiesTextArea(...)
  116.  
  117. ElseIf q.QuestionType = "Radio Button" Or q.QuestionType = "Check Box List" Or q.QuestionType = "Scale" Or q.QuestionType = "Yes/No" Then
  118.  
  119. CreatePropertiesListControl(...)
  120.  
  121. ElseIf q.QuestionType = "Multi-Select List Box" Then
  122.  
  123. CreatePropertiesListBox(...)
  124.  
  125. End If
  126.  
  127. 'Add the properties to the document
  128. elFieldElement.AppendChild(elPropertiesElement)
  129.  
  130. 'Create the base objects for the answers
  131. Dim elListItemsElement As XmlNode
  132. Dim elListItemElement As XmlNode
  133.  
  134. 'Create the listitems element
  135. elListItemsElement = xmlQuestionnaireData.CreateElement("LISTITEMS")
  136.  
  137. 'Some questions have specific listitem structures
  138. If q.QuestionType = "Scale" Then
  139.  
  140. CreateAnswersScale(...)
  141.  
  142. ElseIf q.QuestionType = "Yes/No" Then
  143.  
  144. CreateAnswersYesNo(...)
  145.  
  146. ElseIf q.QuestionType = "Check Box List" Then
  147.  
  148. CreateAnswersCheckBoxList(...)
  149.  
  150. Else
  151.  
  152. 'Otherwise, write out the answers normally
  153. CreateAnswers(...)
  154.  
  155. End If
  156.  
  157.  
  158. elFieldElement.AppendChild(elListItemsElement)
  159.  
  160. Next
  161.  
  162. 'Add everything to the document
  163. elPage.AppendChild(elFields)
  164. elPages.AppendChild(elPage)
  165. elForm.AppendChild(elPages)
  166.  
  167. xmlQuestionnaireData.AppendChild(elForm)
  168.  
  169. Return xmlQuestionnaireData

Thanks for looking at this.

To answer your questions in red:

'Is this entire thing in another loop?
No.

'Does this part matter? It seems like it doesn't, and you only
'choose the above line later on anyway.


There are two properties of this class that contain questions. If this is a parent/child questionnaire, the Me.ParentChildQuestions property will contain a collection of questions for all the questions for the entire questionnaire set. So it could have questions from three different questionnaires.

If it is a standalone questionnaire, the Me.Questions propery will contain a collection of questions just for that questionnaire.

The whole reason I'm looking at this is because the sql query I use gets all the questions for the questionnaire set, but I need to separate them into a new section for each child questionnaire.

BTW, [ code=VB.NET ] is how you specify the language.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Queryable Collections

 
0
  #6
Mar 7th, 2008
Thanks. I'll look at it and give you back the results.

One quick question as well, this function works properly, you just wish to make it more efficient and condensed, correct?

I will make it more efficient and condense it.

Add trace to your page, and open the page, and refresh it. Do this 10 times and keep track of each time the value "From Last(s)" for this certain function. To see how long this function is taking, add a trace to the page manually as well:
  1. ...
  2. ...
  3.  
  4. Trace.Write("tracename","Tracedescription")
  5. call the function
  6. Trace.Write("tracename","tracedescription")
  7.  
  8. ex:
  9.  
  10. Trace.Write("Before","Before Function")
  11. QuestionnaireFunction()
  12. Trace.Write("After","Function")
This will tell you how long it takes to execute.

I like this part, making things more efficient

I'll get back to you momentarily.
Last edited by SheSaidImaPregy; Mar 7th, 2008 at 3:50 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Queryable Collections

 
0
  #7
Mar 7th, 2008
Unfortunately I don't think you can skip any steps here. It seems all quite logical. If you do skip steps, that would require a different route to take and can be a waste of time, as performance gains would be very minimal. It's done alright here.

Here is my edited version:
(Before Edit: Lines: 170)
(After Edit: Lines: 135)
  1. 'Create default xml objects
  2. Dim xmlQuestionnaireData As New XmlDocument()
  3. ''Combined all Declared Variables as they have same datatype
  4. Dim elForm, elPage, elPages, elQuestionnaire, elFields As XmlElement
  5.  
  6. Dim questionnaireid As Integer = 0
  7.  
  8. 'Create the xml header.
  9. xmlQuestionnaireData.AppendChild(xmlQuestionnaireData.CreateXmlDeclaration("1.0", "utf-8", Nothing))
  10.  
  11. 'Add the base elements.
  12. elForm = xmlQuestionnaireData.CreateElement("FORM")
  13. elPages = xmlQuestionnaireData.CreateElement("PAGES")
  14. elPage = xmlQuestionnaireData.CreateElement("PAGE")
  15.  
  16. 'Add the questionnaire name and page info...
  17. elPage.Attributes.Append(xmlQuestionnaireData.CreateAttribute("title")).Value = _QuestionnaireName
  18. elPage.Attributes.Append(xmlQuestionnaireData.CreateAttribute("id")).Value = "Page_1"
  19.  
  20. 'Create the element for the intro text.
  21. elQuestionnaire = xmlQuestionnaireData.CreateElement("INFO")
  22. elQuestionnaire.InnerText = _introText
  23. elPage.AppendChild(elQuestionnaire)
  24.  
  25. 'Create the container for the questions
  26. elFields = xmlQuestionnaireData.CreateElement("FIELDS")
  27.  
  28. 'Get the questions from the questionnaire
  29. Dim dsQuestions As New App.BLL.Questionnaires.QuestionCollection
  30.  
  31. 'If this questionnaire is a parent of other questionnaires, get the ParentChildQuestions Collection
  32. If Me.ParentChildQuestions.Count > 0 Then dsQuestions = Me.ParentChildQuestions Else dsQuestions = Me.Questions
  33.  
  34. 'Create objects for the question
  35. ''Combined variables with same datatype
  36. Dim elFieldElement, elPropertiesElement, elPropertyElement As XmlNode
  37.  
  38. Dim questionnaireDataService As New App.DAL.Questionnaire.QuestionnaireDataService()
  39.  
  40. Dim dsChildren As New DataSet = questionnaireDataService.GetChildren(_Questionnaireid)
  41.  
  42. 'Loop through the questions
  43. For Each q As App.BLL.Questionnaires.Question In dsQuestions
  44.  
  45. 'If this is a parent/child questionnaire, and this is a new section, create the section header
  46. If Me.ParentChildQuestions.Count > 0 And (Not q.Questionnaireid = questionnaireid) Then CreateChildQuestionnaireElement(xmlQuestionnaireData, elFieldElement, elFields, elPropertiesElement, elPropertyElement, q.Questionnaireid)
  47.  
  48. 'Update the questionnaireid variable
  49. questionnaireid = q.Questionnaireid
  50.  
  51. 'Create the base element for this question
  52. elFieldElement = xmlQuestionnaireData.CreateElement("FIELD")
  53.  
  54. 'Create the attributes for the field element
  55. ''Using "with" command to help.
  56. ''You can try (I never have), using the next line and removing "Attributes" from
  57. ''next following lines:
  58. ''With elFieldElement.Attributes
  59. With elFieldElement
  60. .Attributes.Append(xmlQuestionnaireData.CreateAttribute("id")).Value = q.Questionid
  61. .Attributes.Append(xmlQuestionnaireData.CreateAttribute("label")).Value = q.Question
  62. .Attributes.Append(xmlQuestionnaireData.CreateAttribute("required")).Value = q.Required
  63. .Attributes.Append(xmlQuestionnaireData.CreateAttribute("type")).Value = q.ControlType
  64. End With
  65.  
  66. 'Create the validation types and pass the regular expressions
  67. ''You should always use select statements if you have more than a simple if...else...end if
  68. ''Performance gains a nice.
  69. Select Case q.ValidationType
  70. Case "Date" : CreateValidationDate(xmlQuestionnaireData, elFieldElement, q)
  71. Case "Currency" : CreateValidationCurrency(xmlQuestionnaireData, elFieldElement, q)
  72. Case "Numeric" : CreateValidationNumeric(xmlQuestionnaireData, elFieldElement, q)
  73. Case "Email" : CreateValidationEmail(xmlQuestionnaireData, elFieldElement, q)
  74. Case "Password" : CreateValidationPassword(xmlQuestionnaireData, elFieldElement, q)
  75. Case "URL" : CreateValidationURL(xmlQuestionnaireData, elFieldElement, q)
  76. Case "Phone" : CreateValidationPhone(xmlQuestionnaireData, elFieldElement, q)
  77. Case "Zip" : CreateValidationZip(xmlQuestionnaireData, elFieldElement, q)
  78. ''You should always have a Case Else, a default incase of an error.
  79. End Select
  80.  
  81. 'Add the element to the document
  82. elFields.AppendChild(elFieldElement)
  83.  
  84. 'Create elements for the question properties
  85. elPropertiesElement = xmlQuestionnaireData.CreateElement("PROPERTIES")
  86. elPropertyElement = xmlQuestionnaireData.CreateElement("PROPERTY")
  87.  
  88. 'Question name in HTML
  89. elPropertyElement.Attributes.Append(xmlQuestionnaireData.CreateAttribute("name")).Value = "ID"
  90. elPropertyElement.InnerText = "questionid_" & q.Questionid.ToString()
  91.  
  92. 'Add the element
  93. elPropertiesElement.AppendChild(elPropertyElement)
  94.  
  95. 'Create special properties for different question types. Each type can have a seperate CSS class.
  96. Select Case q.QuestionType
  97. Case "Text Box" : CreatePropertiesTextBox(...)
  98. Case "Password" : CreatePropertiesPassword(...)
  99. Case "Text Area" : CreatePropertiesTextArea(...)
  100. Case "Radio Button", "Check Box List", "Scale", "Yes/No" : CreatePropertiesListControl(...)
  101. Case "Multi-Select List Box" : CreatePropertiesListBox(...)
  102. ''Should have a Case Else for default.
  103. End Select
  104.  
  105. 'Add the properties to the document
  106. elFieldElement.AppendChild(elPropertiesElement)
  107.  
  108. 'Create the base objects for the answers
  109. ''Combined, same datatype
  110. Dim elListItemsElement, elListItemElement As XmlNode
  111.  
  112. 'Create the listitems element
  113. elListItemsElement = xmlQuestionnaireData.CreateElement("LISTITEMS")
  114.  
  115. 'Some questions have specific listitem structures
  116. Select Case q.QuestionType
  117. Case "Scale" : CreateAnswersScale(...)
  118. Case "Yes/No" : CreateAnswersYesNo(...)
  119. Case "Check Box List" : CreateAnswersCheckBoxList(...)
  120. 'Otherwise, write out the answers normally
  121. Case Else : CreateAnswers(...)
  122. End Select
  123.  
  124. elFieldElement.AppendChild(elListItemsElement)
  125.  
  126. Next
  127.  
  128. 'Add everything to the document
  129. elPage.AppendChild(elFields)
  130. elPages.AppendChild(elPage)
  131. elForm.AppendChild(elPages)
  132.  
  133. xmlQuestionnaireData.AppendChild(elForm)
  134.  
  135. Return xmlQuestionnaireData
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Queryable Collections

 
0
  #8
Mar 7th, 2008
Without Commenting lines, it's a lot smaller than it was:
Lines Before Edit: 143
Lines After Edit: 98

A nice 45 line savings ^^

It should be a lot quicker in performance as well.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 72
Reputation: cmhampton is an unknown quantity at this point 
Solved Threads: 10
cmhampton's Avatar
cmhampton cmhampton is offline Offline
Junior Poster in Training

Re: Queryable Collections

 
0
  #9
Mar 7th, 2008
Thanks for the help. The method is only taking 14 hundredths of a second anyway, so I wasn't too worried about time savings. The way I'm doing it just seemed counter-intuitive. I kept telling myself there had to be a better way, but I guess not.

BTW, thanks for pointing out the select statement. I don't know how I missed that.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Queryable Collections

 
1
  #10
Mar 7th, 2008
No problem.

I'm a performance geek I guess. I sit here at work almost all day long just finding what is faster than what, and tweaking a 1500 line file I use whenever I build an application, just to make my life easier.

But no, I don't believe it will be easier another way. Who knows, someone else might find a better one!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC