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

You are currently viewing the ASP.NET 3.5 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 April 17th, 2010, 02:42 PM
Authorized User
 
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default How to use Search query for my database?

I want to create a search engine for my website.

-i have a textbox for the user to search from my database records.

- And a Search Button.

In the search button click event , i have a connection string for the Database.

-I just want to know how to relate the search textbox with the sql query i created in connection string.

eg:'

Stringvariable=Textbox1.text;
//open the connection
DbCommand cmd = conn.CreateCommand();

cmd.CommandText = "SELECT F.PredictId, F.PredictionTopic, F.Memlgname, F.MemPrediction, F.UknowY, F.Memvote, C.MemComments, C.CommUserName FROM Forumtable AS F LEFT OUTER JOIN CommentTable AS C ON F.PredictId = C.PredictId WHERE F.MemPrediction Like '%' ORDER BY F.PredictId asc ";

-My question is i want to refer the textbox1 in the place of "Like '%' ".

-how can i do that. Please help.
 
Old April 19th, 2010, 01:13 PM
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

Provided that you are using a .NET Textbox Server Control you can get its value by simply doing:

[nameofyourtextbox].Text

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
Query to Search for a value in a table Vendirella SQL Language 0 October 10th, 2007 12:47 AM
query name search dstein4d Access VBA 1 August 13th, 2007 12:19 PM
search query problem keyvanjan Classic ASP Basics 3 May 11th, 2006 11:01 AM
Trimming a query for search arnabghosh Classic ASP Databases 1 May 31st, 2005 07:39 AM
Users selection driven search query... mat41 Classic ASP Databases 3 November 16th, 2004 03:14 AM





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