Data Binding Issue

Hello Experts,

I have a SQL select that will always return 2 rows and 3 fields. I need to bind Row 1 to txt1, txt2 and txt3 and bind Row 2 to txt4, txt5 and txt6.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

how do you execute your SQL? Datareader? DataSet?
Éric MoreauSenior .Net ConsultantCommented:
can't you bind it to a datagrid control ?
JackW9653Author Commented:
Here is the SQL code:

Dim myDS As New DataSet

        Dim strSelect As String = "SELECT tblScheduleData.Encounter_code, tblScheduleData.Episode, tblScheduleData.ItemType" & _
        "FROM(tblScheduleData)" & _
        "WHERE(tblScheduleData.Case_Name = N) '" & strPatient & "' AND" & _
        "tblScheduleData.ItemType = N 'E' OR " & _
        "tblScheduleData.ItemType = N 'P' OR " & _
        "tblScheduleData.ItemType = N 'D'"

            Dim sqlda As New SqlClient.SqlDataAdapter(strSelect, cn)
            sqlda.Fill(myDS, 0, 20, "tblScheduleData")

        Catch ex As SqlClient.SqlException
            MsgBox("an error occurred - " & ex.Message)
        End Try

        Dim myDV As New DataView(myDS.Tables("tblScheduleData"))


Datagrid isn't an option emoreau as these fields are being used to send parameters to a Crystal Report.
I am no expert  but maybe something along these lines???

txt1.text = myDS.Tables("tblScheduleData").Rows(0).Item(0).ToString
txt2.text = myDS.Tables("tblScheduleData").Rows(0).Item(1).ToString
txt3.text = myDS.Tables("tblScheduleData").Rows(0).Item(2).ToString
txt4.text = myDS.Tables("tblScheduleData").Rows(1).Item(0).ToString
txt5.text = myDS.Tables("tblScheduleData").Rows(1).Item(1).ToString
txt6.text = myDS.Tables("tblScheduleData").Rows(1).Item(2).ToString

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JackW9653Author Commented:
Thanks apuma, it was just what i was looking for.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.