Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jimm222
Starting Member
2 Posts |
Posted - 2008-02-17 : 06:33:42
|
Hi folks,This is what I want to do,but is it possible. I think I have got the hang of queries and stuff like that but here is what I want to do.I am using the 2008 express freebie from microsoft with Sql server 8 freebie.Here is waht I want to do. Place a load of buttons on a screen each one with a list in it.so for example box one will specify all the days of the week,the others all the colors of the rainbow and the others all the month in the years.So the the boxes will feed through to a tiny little sql server database with three tables...days..colours...months.I want somebody to be able top come along and then click on a particular day of the week...let's say thursday...then click on a colur.lets say pink...then click on a month,lets say september..Then a table will appear with that info in it..i.e. thursday,yellow september.I know I could write a little prog in VB or C++ to do this but I am trying to relate it to a database.I think the bottom line here is that I am trying to get the user to create the query and get the result of that query out onto a page.As you can see I am just below novice level and I think the question I am really asking is that is it possible that the person using my program is actually making up a query(based on my criteria)and can get a result,rather than me have top store a query(or stored procedure) that just responds to a click on the box.If this lot makes any sense what so ever,then could someone kind soul point me it the right direction(or any direction) :)ThanksJimm222 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-17 : 08:43:10
|
The buttons,listbox etc are done using your front end application. The database related part here will the queries to populate your listboxes for ex, to get the day info,colur info...that will nothing more than simple SELECT Color FROM ColorsOnce you write similar queries and populate your list boxes, the user will select will select one of item from each box. this selected event will also be handled by your front end. It gets the selected value from each list and passes it to db to retrieve the details. this can be either done using LINQ or using stored procedure.If you consider ease of maintainablilty always go for stored procedure. In either case, you will have a query that retrives you details based on selected info. A sample stored procedure would be:-CREATE PROCEDURE RetrieveDetails@Days varchar(50)=NULL,@Colour varchar(50)=NULL,@Month varchar(50)=NULLASSELECT fields FROM Table1JOIN Table2ON fields....WHERE (Colour=@Colour OR @Colour IS NULL)AND (Day=@Day OR @Day IS NULL)AND (Month=@Month OR @Month IS NULL)GO |
 |
|
|
|
|
|
|
|