Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
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 June 13th, 2006, 04:28 AM
Registered User
 
Join Date: Jun 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Vinay Chugh
Default Query Problem or Code Wrong --- Need Support !

Hi guys !
I am trying to search my database with some value enterd by the user in a textbox.The search result has to be displayed in a ListBox on click of search button.

The problem is that when i use the LIKE predicate with 'A%' it gives all the values in ListBox but when i use LIKE predicate as LIKE '"+TextBox1.Text+"' the result is not shown and i get an error saying one or more Parameters are not given values.
PLease Please PLease Help me guys !

My code snippet is as follows:
void Search_Click(object Source, EventArgs e)
     {
        if (RadioButtonList1.SelectedIndex == 0)
        {
            // ....Intializing the Strings....//

           tring connectionstring;
           string queryString;

           DataSet ds = new DataSet();
           OleDbConnection dbconnection;
           OleDbDataAdapter ad;
           connectionstring = "Provider=Microsoft.Jet.OLeDb.4.0;DATA SOURCE=" +
                       Server.MapPath("\\Database\\New_Tool.mdb") ;
           queryString = "SELECT Company_Name FROM CompanyName WHERE Company_Name LIKE '"TextBox1.Text"' ";


           dbconnection = new OleDbConnection(connectionstring);
           dbconnection.Open();
           ad = new OleDbDataAdapter(queryString, dbconnection);

           ad.Fill(ds,"Company_Name");

           ListBox1.DataSource = ds;
           ListBox1.DataTextField = "Company_Name";
           ListBox1.DataValueField = "Company_Name";
           ListBox1.DataBind();


          }
       }


Vinay Chugh

If I rest, I will rust ! Let's share the knowledge !
 
Old June 20th, 2006, 05:25 AM
Authorized User
 
Join Date: Apr 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

queryString = "SELECT Company_Name FROM CompanyName WHERE Company_Name LIKE '" + TextBox1.Text + "' ";

 
Old June 22nd, 2006, 12:35 AM
Registered User
 
Join Date: Jun 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Vinay Chugh
Default

Quote:
quote:Originally posted by rumbafum
 queryString = "SELECT Company_Name FROM CompanyName WHERE Company_Name LIKE '" + TextBox1.Text + "' ";

Hello Dear I have tried the same and it is still NOT working. Appreciate your response to the query as this is first response i recieved after so many reviews to it !!!!!!
Could u Please provide Anyother solution to the same. Need solution to make it working!

Thanks and Best Regards,
Vinay Chugh
Vinay Chugh

If I rest, I will rust ! Let's share the knowledge !





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with following Insert Query? [email protected] VB.NET 2002/2003 Basics 1 September 19th, 2006 04:41 PM
What is wrong with this query?... rupen Access 5 April 30th, 2006 01:28 AM
does access 2003 support paramemters in query? connect2sandep Access 1 October 16th, 2005 12:04 AM
What`s wrong with Query??? :( Varg_88 Classic ASP Basics 8 January 18th, 2005 09:41 AM
What is wrong with this Query? Section? xgbnow Pro VB Databases 3 February 9th, 2004 05:53 AM





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