Retrieve data using datarow with parameter

Giganews Newsgroups
Subject: Retrieve data using datarow with parameter
Posted by:  Coderz (jpabs…@gmail.com)
Date: Wed, 31 Dec 2008

I have this line of code working from my previous source code updated
to version 2008 of VB.NET

Dim drRegularLoadID() As DataRow =
dsStudentCourse.Tables("RegularLoad").Select("ProgramID = " &
intProgramID & " And MajorID = " & intMajorID & " And Semester = '" &
SemValue & "' And Year = '" & YearValue & "'")

If drRegularLoadID.Length = 0 Then
     MessageBox.Show("No matching record(s)
found.")
    Exit Sub
End If

This is working fine. However I have created a new project and is
using a latest connection using tableadapter instead of dataadapter. I
do not think this has something to do with the code above since the
only code I've change is only the dataset which is dsStudentCourse.

In my new project I just simply change the dsStudentCourse to
EnrollSystemDataSet.

Here it is:

Dim drRegularLoadID() As DataRow =
EnrollSystemDataSet.Tables("RegularLoad").Select("ProgramID = " &
intProgramID & " And MajorID = " & intMajorID & " And Semester = '" &
SemValue & "' And Year = '" & YearValue & "'")

But it does not return a record.

I am thinking about the dataset that causes the problem. But I do not
think so.

Any ideas?

Replies