.NETGURU
EOF For OleDbDataAdapter or DataSet
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-oledb' list.


Kilgo, John (alt)
-- Moved from [aspngdata] to [ngfx-oledb] by Tony Stark <Click here to reveal e-mail address> --

My first "real" .Net page displays all of the tables in a database in a
dropdownlist. Upon selection of a table name, a DataGrid (with paging)
displays the data. Some of the tables, however, contain no rows.

When a table with no rows is selected it usually displays the column names
and nothing else. Occasionaly (inconsistently), however, I receive an error
saying that the DataGrid's PageIndex must be > 0. I would like to avoid
this inconsistent error, and I would like to display "No Rows Found" in a
label for these tables.

My problem is I can't seem to find an EOF or IsEmpty type of property to let
me know that no rows were returned.

A code snippet follows:
Dim dadTableRecs As OleDbAdapter
Dim dstTableRecs As DataSet
strTable = ddlTables.SelectedItem.Text
strSQL = "SELECT * FROM " & strTable
dadTableRecs = New OleDbAdapter(strSQL, strConn)
dstTableRecs = new DataSet
dadTableRecs.Fill(dstTableRecs)
dtgDataGrid.DataSource = dstTableRecs
dtgDataGrid.DataBind()

Somewhere in there there is bound to be a way to know that no rows were
returned.

Thanks for any help you can provide.

John Kilgo

John Kilgo
Brandt Information Services, Inc.
Click here to reveal e-mail address
(850) 877-7713 ext. 554

Reply to this message...
 
    
Andy Smith
the DataSet has a Rows collection, which you could check for a 0 Count.

[Original message clipped]

    > dtgDataGrid.DataSource =3D dstTableRecs
    > dtgDataGrid.DataBind()
    dtgDataGrid.Visible =3D True
    lblNoRows.Visible =3D False
Else
    dtgDataGrid.Visible =3D False
    lblNoRows.Visible =3D True
End If

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
 
System.Data.DataSet
System.Data.OleDb.OleDbDataAdapter
System.Web.UI.WebControls.DataGrid
System.Windows.Forms.DataGrid




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification