Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 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 October 3rd, 2007, 09:34 AM
Authorized User
 
Join Date: Jul 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to u2clone
Default .NET Queries with Databases in C#

I've been developing the following website www.luxlifeinternational.com and have only gotten into .NET in May and Databases in June/July. No formal training and am learning web development on the fly.

The query works on the site (if you select the US, Nevada, and Price 3-4 mil - some houses will come up - we don't have many - more of samples anyway right now).

The two things it doesn't do are 1. if no homes are returned say "No Homes Match Your Criteria" and 2. Allow search for ANY. Below is the codebehind used when the submit button is pressed.

    protected void SearchTest(object sender, EventArgs e)
    {
        string strNewPage;
        strNewPage = "~/luxlistings/default.aspx?countryid={0}&stateid={1}&priceid={2} ";
        strNewPage = string.Format(strNewPage, Country_Select.SelectedValue, State_Select.SelectedValue, Price_Select.SelectedValue);
        Response.Redirect(strNewPage);
    }

I really need to learn how to do the No Listings Returned and the Any searches. Is there anyone who can help me out. I really want to learn it, but I can't find any good samples online.

Thanks!

__________________
\"Freedom is the right of all sentient beings\" - Optimus Prime
 
Old October 3rd, 2007, 10:17 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This really doesnt tell us anything about your database:

   protected void SearchTest(object sender, EventArgs e)
    {
        string strNewPage;
        strNewPage = "~/luxlistings/default.aspx?countryid={0}&stateid={1}&priceid={2} ";
        strNewPage = string.Format(strNewPage, Country_Select.SelectedValue, State_Select.SelectedValue, Price_Select.SelectedValue);
        Response.Redirect(strNewPage);
    }

It just shows us how you redirect to another page.

What you could do if, for example, you are populating a dataset with the results returned from sql is something like

if(ds.Tables[0].Rows.Count == 0)
{
   Response.Write("No homes match your criteria!");
}
else
{
   control.DataSource = ds.Tables[0];
   control.DataBind();
}

For your second problem, have you read about Full Text Index's? This might be the way to go to search your entire database.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
 
Old October 3rd, 2007, 10:37 AM
Authorized User
 
Join Date: Jul 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to u2clone
Default

Thanks. Not sure I am tracking with the first part, is that c#? Like I said, really raw on some of this.

What do you need me to post on here to give you an idea regarding the Not Returning any Matches part. I'm assuming that there is part of that code that will need some exact information that I have in my code.

Just trying to wrap my brain around it.

 
Old October 3rd, 2007, 11:47 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ok let me back up. Show me the code that you use to get data from your Database server and we can work from there =]

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with databases in ASP.NET 2.0 dschips ASP.NET 2.0 Basics 1 March 3rd, 2007 11:57 PM
does .NET support PostGreSQL databases crmpicco ASP.NET 2.0 Basics 0 February 2nd, 2007 06:38 AM
Professional ASP.NET 2.0 Databases bonekrusher BOOK: Beginning ASP.NET 2.0 and Databases 2 January 3rd, 2007 10:37 AM
ASP.NET Databases Using VB.NET Christiane Giguere General .NET 2 January 23rd, 2005 02:27 PM
Beginning ASP.Net Databases Using VB.Net ISBN 6195 tlamazares SQL Server ASP 1 December 15th, 2003 01:28 PM





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