Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2005, 11:33 AM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Handling an empty dataset

I have an Access database with items from a collection stored in it. Each item is in one of four catagories and the datagrid shows the items in a specific catagory based on a drop down list selection. Sometimes there won't be anything in a specific catagory like "For Sale" and I don't want to show a datagrid header with nothing in the datagrid (this is what my page is doing now). I am coding everything by hand; I don't use VS.NET.

Here is my function which is part of a namespace that I have compiled:

Code:
Public Function GetBalisongList(strStatus as string, strSort as string) as Dataset
    If strStatus = "complete" Then
        strSQL = "SELECT BalisongID, make, model, status FROM balisong ORDER BY " & strSort
    Else
        strSQL = "SELECT BalisongID, make, model, status FROM balisong WHERE status = '" & strStatus & "' ORDER BY " & strSort
    End If
    Dim objConnection as New OLEDBConnection(m_DSN)
    Dim objDataAdapter as New OLEDBDataAdapter(strSQL, objConnection)
    Dim BalisongList as new Dataset()
    objDataAdapter.Fill(BalisongList)
    Return BalisongList
End Function
Here is the sub that handles the drop down list in my code behind page:

Code:
Public Sub balisongfilter(sender as object, e as eventargs)
    ViewState("status") = ddl_balisong.SelectedItem.Value
    If ViewState("status") = "description" Or ViewState("status") = "" Then
        lblinstructions.visible = true
        dgBalisongList.visible = false
        rptBalisongDetails.visible = false
    Else
        strSort = "make, model"
        Dim BalisongStatusList as new Balisong(strconnect)
        dgBalisongList.DataSource = BalisongStatusList.GetBalisongList(ViewState("status"), strSort)
        dgBalisongList.DataBind()
        lblinstructions.visible = false
        dgbalisonglist.visible = true
        rptBalisongDetails.visible = false
    End If
End Sub
I am trying to display an asp:label saying something like, "I do not currently have any balisongs for sale." instead of an empty datagrid. Thank you in advance for any help you can provide.

 
Old January 21st, 2005, 12:35 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

This is a classic ASP forum. Repost the question in appropriate .NET forum to get any response.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 21st, 2005, 12:42 PM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didn't realize that. Thank you.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Empty DataSet Populated By Stored Procedure WestAussie Visual Studio 2005 5 April 8th, 2008 02:42 PM
Handling empty text files in DTS ahofle SQL Server DTS 1 January 22nd, 2006 12:29 AM
Help checking for empty dataset Payback ASP.NET 1.0 and 1.1 Basics 5 March 28th, 2005 05:00 AM
Handling AutoNumbers in Dataset reyboy ADO.NET 3 December 25th, 2004 10:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.