[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Moving to Next Row in DataSet with Criteria

Posted on 2011-03-25
8
Medium Priority
?
299 Views
Last Modified: 2012-05-11
Hello Experts,

Under a specific set of conditions I need to move to the next "Core" question. In my dataset I get the question type as one of fields, there are only 2 values; "Core" or "Followup". So I want to skip all the "Followup" questions and find the next "Core".

Thanks in advance for any help;

JackW9653
0
Comment
Question by:JackW9653
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 35219918
You can use a DataView to filter the DataTable
0
 

Author Comment

by:JackW9653
ID: 35219949
Thanks for the quick reply jpaulino, but I'm iterating through the dataset using the following code:
If intRow < intRowCount - 1 Then
              intRow = intRow + 1
              strQuestion = myDSALL.Tables(0).Rows(intRow).Item("Q_Key").ToString()
        Else
            MessageBox.Show("You have reached the end")
        End If

Open in new window


A dataview wouldn't be applicable here. Thanks.
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 35219979
That way you cannot jump ... you need to check the value and decide :(
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:JackW9653
ID: 35220001
So you would replace the dataset with a dataview?
0
 

Author Comment

by:JackW9653
ID: 35220061
Doesn't a dataview only work against a single table? Here is how I'm filling my dataset:

  Dim strSelect As String = "SELECT q.Q_Key, p.Question, p.Response, q.Q_Type, q.Q_Trigger, q.Q_Trigger_Value, q.Sequence " & _
            "FROM tblQuestionnaire q " & _
            "Left Join LookupIQ_QuestionPool p ON q.Q_Key = p.Q_Key " & _
            "WHERE q.Q_Name = 'SOB013' " & _
            "Order By Sequence"

            Dim sqlda As New SqlCeDataAdapter(strSelect, cn)

            sqlda.Fill(myDSALL, "tblQuestionnaire")
            If myDSALL.Tables(0).Rows.Count > 0 Then
                intRowCount = myDSALL.Tables(0).Rows.Count
                strQuestion = myDSALL.Tables(0).Rows(intRow).Item("Q_Key").ToString()
                strTrigger = myDSALL.Tables(0).Rows(intRow).Item("Q_Trigger").ToString()
                strTrigger = myDSALL.Tables(0).Rows(intRow).Item("Q_Trigger_Value").ToString()
            Else
                MsgBox("Question records not found!")
            End If
        Catch err As SqlCeException
            MsgBox("An error occurred in LoadAllQuestions - " & err.Message)
        Finally
            cn.Close()
        End Try

How can I use a  dataview here?
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 35220243
Dataview allows you to filter a datatable and not replace it.

Do you know what you need before fill the dataset? You could just filter in the select statement
0
 

Author Comment

by:JackW9653
ID: 35220347
I'm using the  WHERE clause to get the right name and sequence. I've added a new section that specifies the Type = Core, and am debugging it now. Basically if the users response matches the criteria it goes in sequence, if not it fires a different Select that only looks at 'Core' questions.

What do you think?
0
 

Author Closing Comment

by:JackW9653
ID: 35462941
Used Dataview, Thanks. Sorry for the delay, forgot question was still open.

Jack
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question