Printing a database

Gizmosays

Member
Joined
May 22, 2005
Messages
6
Programming Experience
Beginner
Hello, I have a movie database that currently holds 168 records I was setting up the print property in my appliaction that executes a sql statment to querie all the movies to a string call Strbody. My problem is that a printed page only holds 44 records and thats what is print out, the rest of the records are not printed at all I have read about the hasmorepages event but, I have no idea how I would be able track at which point in the string to continue any ideas? Here is the code that I am using. Thanks

Dim Num As Integer
Dim ObjOleDbConnection As OleDbConnection
Dim objOleDbCommand As OleDbCommand
Dim objOleDbDataReader As OleDbDataReader
Dim StrSql As String = "SELECT Movies.Title, Movies.Category, & _ Movies.Ratings, Movies.Length, Movies.Movielocation, Movies.UserReview &_ FROM(Movies)ORDER BY Movies.Title"
Dim StrBody As String
Connection()
Try
'Calling the getdatareader function
objOleDbDataReader = GetDataReader(StrSql)
'Building the strbody string
Do While (objOleDbDataReader.Read()
Num = Num + 1
StrBody = StrBody & _
Num & ControlChars.Tab & _
objOleDbDataReader.Item("Title") & ControlChars.Tab & ControlChars.Tab & ControlChars.Tab & _
objOleDbDataReader.Item("Category") & ControlChars.Tab & _
objOleDbDataReader.Item("Ratings") & ControlChars.Tab & _
objOleDbDataReader.Item("Length") & ControlChars.Tab & _
objOleDbDataReader.Item("Movielocation") &
ControlChars.Tab & _
objOleDbDataReader.Item("UserReview") & ControlChars.Tab & ControlChars.NewLine
Loop
Catch ex As Exception
End Try
MessageBox.Show(StrBody)
Return StrBody
End Function
 
Back
Top