Nesting DataReaders?

Bahatmut

Active member
Joined
Jun 14, 2005
Messages
29
Location
NY
Programming Experience
Beginner
Ok, all the help I've gotten ehre has been of tremendous aide to me. This one I thought would work, but I think I'm goofing someplace, and I can't wrap my head around datagrids enough yet to even attempt them, doubly since I'm just looking for display. The aim is to pull a range of records from one table, then pull a second range of records for each of the items in the first table. Below is the code I am using. I get an error when the second data reader tries to execute. Please forgive all the concatinations, I do go back and remove them later on in the optimization portion of my processes.

VB.NET:
[size=2][color=#0000ff]Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] TitleName [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] TitleID [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] TitleCost [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Double
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] DateAcq [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Date
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Trents [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Tincome [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Double
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] WString [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] ConnectString [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\videobarn\videobarn.mdb;User Id=admin;Password=;"
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myConnection [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection(ConnectString)
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myIConnection [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection(ConnectString)
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] VideoQuery [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = "SELECT Ref, Title, Date_Added,Cost_Price from Videos WHERE Title LIKE " & "'" & TextBox1.Text & "%" & "'"
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] IncomeQuery [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = " Select Ref, Return_Status, Cost FROM Returned_Loans where Ref = " & "'" & TitleID & "'"
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] VideoCommand [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbCommand(VideoQuery, myConnection)
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] IncomeCommand [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbCommand(IncomeQuery, myConnection)
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] VideoReader [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataReader
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] IncomeReader [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataReader
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] SDateAcq [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] SCost [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] STIncome [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] STrents [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
 
[/color][/size][size=2]myConnection.Open()
 
VideoReader = VideoCommand.ExecuteReader
 
TextBox2.Text = ""
 
[/size][size=2][color=#0000ff]While[/color][/size][size=2] VideoReader.Read
 
TitleID = VideoReader.GetString(0)
 
TitleID = TitleID.PadLeft(5, " ")
 
TitleName = VideoReader.GetString(1)
 
TitleName = TitleName.PadRight(50, " ")
 
DateAcq = [/size][size=2][color=#0000ff]CDate[/color][/size][size=2](VideoReader.GetDateTime(2))
 
SDateAcq = Microsoft.VisualBasic.Left([/size][size=2][color=#0000ff]CStr[/color][/size][size=2](DateAcq), 10)
 
TitleCost = VideoReader.GetDouble(3)
 
SCost = [/size][size=2][color=#0000ff]CStr[/color][/size][size=2](TitleCost)
 
SCost = SCost.PadLeft(7, " ")
 
IncomeReader = IncomeCommand.ExecuteReader
 
[/size][size=2][color=#0000ff]While[/color][/size][size=2] IncomeReader.Read
 
Tincome = Tincome + IncomeReader.GetDouble(2)
 
[/size][size=2][color=#0000ff]If[/color][/size][size=2][color=#0000ff]Not[/color][/size][size=2] IncomeReader.IsDBNull(1) [/size][size=2][color=#0000ff]Then
 
[/color][/size][size=2][color=#0000ff]If[/color][/size][size=2] StrComp(IncomeReader.GetString(1), "-", CompareMethod.Text) [/size][size=2][color=#0000ff]Then
 
[/color][/size][size=2]Trents = Trents + 1
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
 
[/color][/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
 
[/color][/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]While
 
[/color][/size][size=2]STIncome = [/size][size=2][color=#0000ff]CStr[/color][/size][size=2](Tincome)
 
STIncome = STIncome.PadLeft(6, " ")
 
STrents = [/size][size=2][color=#0000ff]CStr[/color][/size][size=2](Trents)
 
STrents = STrents.PadLeft(4, " ")
 
WString = TitleID & " " & TitleName & " " & SCost & " " & SDateAcq & " " & STrents & " " & STIncome
 
TextBox2.Text = TextBox2.Text & WString
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]While
 
[/color][/size][size=2]VideoReader.Close()
 
IncomeReader.Close()
 
myConnection.Close()
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub[/color][/size]

[size=2][color=#0000ff]
[/color][/size]

 
Last edited by a moderator:
This is from the help topic for the OleDbDataReader Class, which you should have been the first place you went for help:
While the OleDbDataReader is in use, the associated OleDbConnection is busy serving the OleDbDataReader, and no other operations can be performed on the OleDbConnection other than closing it. This is the case until the Close method of the OleDbDataReader is called.
 
You can only use on "Reader" at a time, which I believe is changing in VS.NET 2005. However, what you can and should use is "multiple result sets." Research that for much more efficient use of the database.
 
Neal said:
You can only use on "Reader" at a time, which I believe is changing in VS.NET 2005. However, what you can and should use is "multiple result sets." Research that for much more efficient use of the database.
If you're talking about multiple SQL statements separated by semicolons, I discovered to my disappointment that Access does not support them.
 
Re-designed, still can't figure this out.

Ok, I went back and separated out the readers...trying instead to use an array varible to hold the processed data so I can have a bit mroe control, but when I debug, it debugs, but I get an
'An unhandled exception of type 'System.NullReferenceException' occurred in VBMovieGroupInfo.exe Additional information: Object reference not set to an instance of an object.' error in the code, and lookgin through teh MSDN to the best of my obviously limited ability has yiedled dead ends. Code is below.


VB.NET:
[size=2][/size][size=2][color=#0000ff]Private[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] TitleName [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] TitleID [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] TitleCost [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Double

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] DateAcq [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Date

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Trents [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Integer

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Tincome [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Double

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] WString [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] ConnectString [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\videobarn\videobarn.mdb;User Id=admin;Password=;"

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myConnection [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection(ConnectString)

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myIConnection [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection(ConnectString)

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] VideoQuery [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = "SELECT Ref, Title, Date_Added,Cost_Price from Videos WHERE Title LIKE " & "'" & TextBox1.Text & "%" & "'"

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] IncomeQuery [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = " Select Ref, Return_Status, Cost FROM Returned_Loans where Ref = " & "'" & TitleID & "'"

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] VideoCommand [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbCommand(VideoQuery, myConnection)

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] IncomeCommand [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbCommand(IncomeQuery, myConnection)

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] VideoReader [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataReader

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] IncomeReader [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataReader

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] SDateAcq [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] SCost [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] STIncome [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] STrents [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] RecordsToProcess [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Integer[/color][/size][size=2] = 0

TextBox2.Text = vbCr

myConnection.Open()

VideoReader = VideoCommand.ExecuteReader

[/size][size=2][color=#0000ff]While[/color][/size][size=2] VideoReader.Read

RecordsToProcess = RecordsToProcess + 1

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]While

[/color][/size][size=2]RecordsToProcess = RecordsToProcess - 1

TextBox3.Text = [/size][size=2][color=#0000ff]CStr[/color][/size][size=2](RecordsToProcess)

VideoReader.Close()

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Storage(,) [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] temp [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Integer[/color][/size][size=2] = 0

VideoReader = VideoCommand.ExecuteReader

[/size][size=2][color=#0000ff]While[/color][/size][size=2] VideoReader.Read

[color=red]Error highlights this line------>[/color]Storage(temp, 0) = VideoReader.GetString(0)

Storage(temp, 1) = VideoReader.GetString(1)

Storage(temp, 2) = VideoReader.GetDateTime(2)

Storage(temp, 3) = VideoReader.GetDouble(3)

temp = temp + 1

[/size][size=2][color=#0000ff]If[/color][/size][size=2] temp > RecordsToProcess [/size][size=2][color=#0000ff]Then[/color][/size][size=2] [/size][size=2][color=#0000ff]Exit[/color][/size][size=2] [/size][size=2][color=#0000ff]While

[/color][/size][size=2][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]While

[/color][/size][size=2]temp = 0

VideoReader.Close()

[/size][size=2][color=#0000ff]For[/color][/size][size=2] temp = 0 [/size][size=2][color=#0000ff]To[/color][/size][size=2] RecordsToProcess

IncomeQuery = " Select Ref, Return_Status, Cost FROM Returned_Loans where Ref = " & "'" & Storage(temp, 0) & "'"

IncomeReader = IncomeCommand.ExecuteReader

[/size][size=2][color=#0000ff]While[/color][/size][size=2] IncomeReader.Read

Tincome = Tincome + IncomeReader.GetDouble(2)

[/size][size=2][color=#0000ff]If[/color][/size][size=2] [/size][size=2][color=#0000ff]Not[/color][/size][size=2] IncomeReader.IsDBNull(1) [/size][size=2][color=#0000ff]Then

[/color][/size][size=2][/size][size=2][color=#0000ff]If[/color][/size][size=2] StrComp(IncomeReader.GetString(1), "-", CompareMethod.Text) [/size][size=2][color=#0000ff]Then

[/color][/size][size=2]Trents = Trents + 1

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]If

[/color][/size][size=2][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]If

[/color][/size][size=2][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]While

[/color][/size][size=2]Storage(temp, 4) = Trents

Storage(temp, 5) = Tincome

IncomeReader.Close()

[/size][size=2][color=#0000ff]Next[/color][/size][size=2] temp

temp = 0
[/size][size=2][color=#0000ff]For[/color][/size][size=2] temp = 0 [/size][size=2][color=#0000ff]To[/color][/size][size=2] RecordsToProcess
STIncome = [/size][size=2][color=#0000ff]CStr[/color][/size][size=2](Storage(temp, 5))

STIncome = STIncome.PadLeft(6, " ")

STrents = [/size][size=2][color=#0000ff]CStr[/color][/size][size=2](Storage(temp, 4))

STrents = STrents.PadLeft(4, " ")

TitleID = Storage(temp, 0)

TitleName = Storage(temp, 1)

SDateAcq = [/size][size=2][color=#0000ff]CDate[/color][/size][size=2](Storage(temp, 2))

SCost = [/size][size=2][color=#0000ff]CStr[/color][/size][size=2](Storage(temp, 3))

WString = TitleID & " " & TitleName & " " & SCost & " " & SDateAcq & " " & STrents & " " & STIncome & vbCr

TextBox2.AppendText(WString)

[/size][size=2][color=#0000ff]Next

[/color][/size][size=2]myConnection.Close()

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff][/color][/size] 
[size=2][color=#0000ff]
[/color][/size]

I realize I may have to put in some Cstr commands, but I don't think that is what is making the errors.
 
You've declared your array but you haven't set it's dimensions, so it has no actual elements. You are trying to set Storage(0, 0) but that variable does not exist. If you know how many elements your array will contain than you should include those numbers in the array declaration. If you don't know then an array is not the best choice. You might be better off using an ArrayList of Arraylists, as ArrayLists are designed to be dynamically resized. If you know one dimension but not the other, you could also use an Array of ArrayLists or an ArrayList of Arrays, depending on which dimension you know.
 
When you get an unhandled exception, particularly a null reference, you should ALWAYS click the Break button and inspect EVERY variable referenced on the offending line. Doing that would have quickly told you that your array element didn't exist.
 
Ok,. hopefully last problem....

Ok, got the array problem figured out, and most of the other problems. Now, my last issue is trygin to sort the data via the SQL query. I used teh MSDN to figure out how to use the ORDER BY to get a single sort on the read data, and saw the syntax for multiple sorts, but it doesn't seem to work. THis is the section of code that is supposed to generate the sort order.

VB.NET:
[size=2]myConnection.Open()

[/size][size=2][color=#0000ff]If[/color][/size][size=2] RadioButton1.Checked = [/size][size=2][color=#0000ff]True[/color][/size][size=2] [/size][size=2][color=#0000ff]Then[/color][/size][size=2] SortOrder = "Date_Added, Ref"

[/size][size=2][color=#0000ff]If[/color][/size][size=2] RadioButton2.Checked = [/size][size=2][color=#0000ff]True[/color][/size][size=2] [/size][size=2][color=#0000ff]Then[/color][/size][size=2] SortOrder = "Date_Added, Title"

VideoQuery = "SELECT Ref, Title, Date_Added, Cost_Price, Category, Spare1 from Videos WHERE Date_Added BETWEEN " & "#" & TextBox1.Text & "#" & " AND " & "#" & TextBox2.Text & "#" & "ORDER BY " & SortOrder

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] VideoCommand [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbCommand(VideoQuery, myConnection)

VideoReader = VideoCommand.ExecuteReader

THe 2 radio buttons are for a selection. Now, each time I run the program, it does sort on the Date_Added, but won't sort on anythign else other than the Ref, regardless of which radio button is selected. Even when I select the Title sort button, and verify that it is selected by breakpoint, the result is still the same, sorted on Date_Added then Ref.
[/size]
 
The code you've posted doesn't really help too much because we can't see the actual SQL statement it produces.
Let's say your ORDER BY clasue looks like this:
VB.NET:
ORDER BY field1 ASC, field2 DESC
This would sort your results in ascending order by field1. Any rows that have the same value for field1 will be sorted in descending order by field2. The field2 value will never be a factor if no field1 values are the same. If ASC or DESC is not specified, ASC is assumed, e.g.
VB.NET:
ORDER BY field1, field2 DESC
would have the same effect, but like always it is better to be explicit.
Finally, you should not build a string like this using the "&" concatenation operator. It certainly works but it is inefficient and hard to read. I suggest using the String.Format function and/or parameters in your SQL code. Also, unless there is a particular reason for using TextBoxes, I'd suggest using DateTimePickers to get your dates as they are easier for the user and validation is taken care of for you.
 
um...ok..I think....maybe

um, I did include the SQL statement that is generated, it's called VideoQuery, and is right under the if-then statements. A text box is being used since it was simpler to get that workign than trygin to grapple with the problems associated with a datagrid, doubly since the end user needs no interaction with the data retreived, only the ability to sort it. The SQL query is designed to pull out all data between a set of dates, and then sort that data first by dates, then for each date sort the rest by title or ID ref. Now, unless the problem is caused because DataReaders only support the full date time stamp, and not just the date itself, I don't see why this isn't working. I know I seem like a total newb...but please, I understand that long string formatting and concatinations are innefficient, but I was always taught to get it running, THEN make it faster. It makes no sense to make it all slick and shiny if you don't understand what it is the code is doing, or worse, if the code doesn't work.
 
First of all, you haven't included the full SQL statement. We don't know what is in TextBox1.Text, TextBox2.Text or SortOrder, and isn't the contents of the SortOrder variable the issue here? How can we tell you what the problem is if we can't see the actual SQL code that is being executed?

Second of all, I'm not talking about making it all slick and shiny. I'm talking about making it as readable as possible. I've seen plenty of people makes mistakes building an SQL query using concatenattion simply because it was more difficult to read.

What you need to do is show us the actual SQL statement that is contained in VideoQuery once the full string has been constructed. If you want it to sort by Date_Added and then by Title, your ORDER BY clause should be "Date_Added ASC, Title ASC".
 
Back
Top