sql to work in text box
OK this is taking place in VB.net 2008. I have created datagrids and a search text box where a user will enter a specific type of book for example if they enter business in the text box it will search the database and display all business books in the grid. I dont know how to get my SQL to work in that fashion in accordance with the text box.
here is my SQL that i have
ALTER PROCEDURE dbo.ParameterBookSalesByType
SELECT SUM(ytd_sales) AS [YTD_Sales], (SUM(ytd_sales) / COUNT(type)) AS [Average_Sales], type AS [Type], COUNT(type) AS [Books Sold]
WHERE type = type
GROUP BY type
now how do i get it to read from the text box and select the various books to display back to the grid.
Re: sql to work in text box
That's pretty simple. First except the value from the user. For instance, if a user types "business" (as you said). Now fire a query specifying all the fields that should be displayed in "SELECT" clause. Now the table in "FROM" clause. Bow match the value in the text box with the entries in the table in the "WHERE" clause. Optionally you can sort your result using "ORDER BY" clause.
SELECT * FROM books_collection WHERE books_type = "business";
|Tags: sql, text box, vbnet 2008|
|Thread Tools||Search this Thread|
|Similar Threads for: "sql to work in text box"|
|Thread||Thread Starter||Forum||Replies||Last Post|
|TEXT message icon not showing text messages in BlackBerry curve 8520||Tabita||Portable Devices||5||28-02-2011 08:23 PM|
|BlackBerry Torch TEXT message icon not showing text messages||rOSAMOND||Portable Devices||8||17-10-2010 01:04 AM|
|Samsung E1120 text message don't work||Gaganadipika||Portable Devices||5||22-04-2010 05:22 PM|