Added: 1 year ago
From: ASPToday
Views: 8,953
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (19)

Sign In or Sign Up now to post a comment!
  • Siper, It finally worked .... U know what I did .....

    Under the 'SelectParameters' I added

    DefaultValue="NULL" for both Textboxes (First & Last Name)

    It has been making me mad since last night. What a simple fix it was ....

  • @punits11 Great. Thanks for sharing.

  • Thanks Siper, I already did that (adding '%' + at front), it didn't made any difference. I think, the problem is not with the query, bcoz when I tested it in "Query Builder" it worked with individual FName search or LName search. Not sure why its failing when I run the code, may be there is some problem with Gridview. But again I don't even get any error message ?

  • Just FYI: The query works perfectly when I test it in "Query Builder".

  • Part 2: ........

    Courses INNER JOIN Registrants ON Courses.Course_Id = Registrants.Course_Id INNER JOIN Course_Names ON Courses.Course_Name_Id = Course_Names.Course_Name_Id WHERE (Registrants.Registrant_F_Name LIKE @Registrant_F_Name + '%') OR (Registrants.Registrant_L_Name LIKE @Registrant_L_Name + '%') ORDER BY Registrants.Registrant_Id DESC

  • @punits11 The only thing I see different than my video is that you didn't put a wildcard ('%') in the beginning of the parameter. Although I don't see why that should make a difference. Maybe try putting in the wildcard in the beginning as well  and see if that helps ( LIKE '%' + @Registrant_F_Name + '%'). Make sure to rebuild your website before running it. Other than that, stackoverflow is the best forum in the world.

  • Its lengthy, so I am posting it in 2 parts ....

    Part 1: .......

    SELECT Course_Names.Course_Name, Courses.Course_Start_Date, Courses.Course_End_Date, Registrants.Registrant_Id, Registrants.Registrant_F_Name, Registrants.Registrant_L_Name,­ Registrants.Registrant_B_Title­, Registrants.Registrant_Agency, Registrants.Fee_Amount, Registrants.Payment_Status FROM

  • Does NOT work when I search on only one name. FName or LName

    When I add both, it works.

    Any idea what wrong I may be doing ?

  • @punits11 I can't really help u without looking at your code. The only thing that comes to mind of hand is that you may have written your query with an "and", not with an "or". If that's not the problem, post your sql query as a comment so I can look at it.

  • Comment removed

  • I currently have a page that has a button that opens a "Search Page"

    I use the above example to choose one of the items in the grid.

    How would I select 1 of the items in the grid view and fill a text box on The main page ???

    Thanks for all your help

  • hi sir thanks soooooooooo much Really your tutorial great it solve my all problems thanks again.

  • Thanks

  • Firstly I want to thank you for the wonderful tutorial but their is quite some problem which i love for you to address. After creating the search box the sorting, editing,selection,paging,updat­ing and canceling controls no longer work for the GridView especial when you are using a large data source. I would love to see this issued solved because I have been having quite a deal of problem solving the situation. I still can't get sorting and updating to work.

  • thank you so much

  • the error message is when itry to search is :

    Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints

  • SELECT Categories.CategoryID, Categories.CategoryName, Categories.Description, Products.ProductID, Products.ProductName, Products.CategoryID AS Expr1, Products.UnitPrice, Products.UnitsOnOrder

    FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID

    WHERE (Categories.CategoryName LIKE '%' + @CategoryName + '%')

    ORDER BY Categories.CategoryID, Categories.CategoryName

  • nice work

    sr i been try to search form two tables but it dose not work

    like in text box CategoryName : BRV

    and i i have inner join in my tabel thsi is the table code in the dataset :

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more