Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 September 27th, 2005, 08:04 AM
Authorized User
 
Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just one correction on the like part of the MakeSQLFunction

like should read
if (sqlLike = "") then
  sqlLike = " LIKE (Office = '" & txtOffice.Text.ToString() & "'"
else
  sqlLike = " AND (Office = '" & txtOffice.Text.ToString() & "'"
end if

do this with all the second like search -> the word AND must be in front.

Are you winning?

Helga

 
Old September 27th, 2005, 08:59 AM
Registered User
 
Join Date: Sep 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well, I have to figure where to incorporate the function. It looks like sqlLike var will get longer and longer? Do I still use the @parameters?

 
Old September 27th, 2005, 09:15 AM
Authorized User
 
Join Date: Sep 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry for delay - was somewhat busy.

Implement the function where you would have done the search. Thus if on your webform is a button search, you would have either placed the code behind the button or would have executed a function that connects to the db and does the work. Now, just prior to binding the command or datareader, declare a string to hold the return of the variable and then return set the string to the function, i.e. strSQLStatement = MakeSQLQuery(). This will generate the string for the command/datareader. then the command/datareader will take the query.

Parameters will actually only work if you used a store procedure and not with a normal sql query. In the original code example i could see that you used a query directly in your code thus parameters will have no use.

Yip, the query will be longer, but remember that with this sql query function it will only be extremely long string if the user supplied all 12 values. The magic of this function is that it will not place a string in the like clause if the user supplied no value. Try it, you will see it's ok.

If you can, email me the original webform and code behind ([email protected]) and i'll place the function for you there. You will see, it's magic and the least code possible yet it should be stable.

Helga

 
Old September 27th, 2005, 09:26 AM
Registered User
 
Join Date: Sep 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I emailed it to you, I got an autoresponse though???







Similar Threads
Thread Thread Starter Forum Replies Last Post
Search button doesn't search Access DB cbones Visual Studio 2008 1 October 27th, 2008 07:36 PM
File Search / Indexing Search with .net 2.0 maulik77 ASP.NET 1.0 and 1.1 Basics 2 March 15th, 2007 12:45 AM
narrowing conversion - please help treasacrowe ASP.NET 1.0 and 1.1 Basics 0 October 18th, 2005 04:42 AM
Search Engine for Full-text Search Kala ASP.NET 1.0 and 1.1 Professional 2 August 29th, 2004 02:16 AM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM





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