Click here to Skip to main content
15,886,199 members
Home / Discussions / Database
   

Database

 
GeneralRe: Simplest query to get last 10 records? Pin
Rahul.P.Menon26-Jun-05 21:47
sussRahul.P.Menon26-Jun-05 21:47 
GeneralReporting Service DataSet Pin
Amal ElHosseiny26-Jun-05 20:35
Amal ElHosseiny26-Jun-05 20:35 
GeneralCheck to see if a Table exists Pin
Wilye26-Jun-05 10:14
Wilye26-Jun-05 10:14 
GeneralRe: Check to see if a Table exists Pin
Colin Angus Mackay26-Jun-05 11:54
Colin Angus Mackay26-Jun-05 11:54 
GeneralRe: Check to see if a Table exists Pin
toxcct27-Jun-05 6:17
toxcct27-Jun-05 6:17 
GeneralRe: Check to see if a Table exists Pin
Bruzak27-Jun-05 19:55
Bruzak27-Jun-05 19:55 
GeneralRe: Check to see if a Table exists Pin
Wilye28-Jun-05 2:55
Wilye28-Jun-05 2:55 
GeneralOLEDB COMMANDS Pin
02088326-Jun-05 9:42
02088326-Jun-05 9:42 
Hi. I have a webform that has several dropboxes that are dynamically populated from a ms access database. Im fairly new to database design. In my drop boxes i have add a "All" Item. which will allow me to search the database for all records.

my problem is:

Drop box one is listing several industries. (independant)
Drop box two lists several uses ( which dynamically change based on the industry selected)

Drop box 3 lists categories (independant)
drop box 4 lists options based on the selected category

I want to be able to search my table for records that match all of the user selected criteria.

im trying to use parameters and I cant figure out the best way to do this... I know what ive done probably isn't the best way to do this... but this is an example of how im creating my query string.


Sub CreateQuery()
Dim SelectPhotos As OleDbCommand
Dim Photo As OleDbDataReader
Dim strSelect As String

Dim SelectedIndustry As String
Dim SelectedUse As String
Dim SelectedCategory As String
Dim SelectedOption As String

strSelect = "Select * From Catalog1 Where "

SelectedIndustry = dropIndustry.SelectedItem.Value
SelectedUse = dropUse.SelectedItem.Value
SelectedCategory = dropCategory.SelectedItem.Value
SelectedOption = dropOption.SelectedItem.Value

SelectPhotos = New OleDbCommand(strSelect, conPhoto)

If SelectedIndustry > 0 Then
SelectPhotos.Parameters.Add("@selectedIndustry", SelectedIndustry)
strSelect += "IndustryID=@SelectedIndustry And "
End If

If SelectedUse > 0 Then
SelectPhotos.Parameters.Add("@selectedUse", SelectedUse)
strSelect += "UseID=@SelectedUse And "
End If

If SelectedCategory > 0 Then
SelectPhotos.Parameters.Add("@selectedCategory ", SelectedCategory)
strSelect += "CategoryID=@SelectedCategory And "
End If

If SelectedOption > 0 Then
SelectPhotos.Parameters.Add("@selectedOption ", SelectedOption)
strSelect += "OptionID=@SelectedOption"
End If

conPhoto.Open()

Photo = SelectPhotos.ExecuteReader()

Photo.Close()
conPhoto.Close()

lblTest.Text = strSelect

End Sub

GeneralGet ID Problem Pin
WDI26-Jun-05 7:35
WDI26-Jun-05 7:35 
GeneralRe: Get ID Problem Pin
Colin Angus Mackay26-Jun-05 12:02
Colin Angus Mackay26-Jun-05 12:02 
Generalserver registration problem Pin
Anonymous26-Jun-05 2:50
Anonymous26-Jun-05 2:50 
GeneralRe: server registration problem Pin
Anonymous26-Jun-05 9:33
Anonymous26-Jun-05 9:33 
GeneralInsert problem Pin
Blue_Skye25-Jun-05 17:08
Blue_Skye25-Jun-05 17:08 
GeneralRe: Insert problem Pin
Luis Alonso Ramos25-Jun-05 17:20
Luis Alonso Ramos25-Jun-05 17:20 
GeneralRe: Insert problem Pin
Blue_Skye26-Jun-05 1:44
Blue_Skye26-Jun-05 1:44 
GeneralRe: Insert problem Pin
Luis Alonso Ramos26-Jun-05 5:31
Luis Alonso Ramos26-Jun-05 5:31 
GeneralRe: Insert problem Pin
toxcct26-Jun-05 7:33
toxcct26-Jun-05 7:33 
GeneralRe: Insert problem Pin
Luis Alonso Ramos26-Jun-05 9:12
Luis Alonso Ramos26-Jun-05 9:12 
GeneralRe: Insert problem Pin
Blue_Skye26-Jun-05 20:13
Blue_Skye26-Jun-05 20:13 
GeneralRe: Insert problem Pin
Luis Alonso Ramos27-Jun-05 5:15
Luis Alonso Ramos27-Jun-05 5:15 
GeneralRe: Insert problem Pin
Blue_Skye26-Jun-05 7:40
Blue_Skye26-Jun-05 7:40 
GeneralRe: Insert problem Pin
Luis Alonso Ramos26-Jun-05 9:13
Luis Alonso Ramos26-Jun-05 9:13 
Generalupdating a database Pin
steve_rm25-Jun-05 2:01
steve_rm25-Jun-05 2:01 
Generalvariable queries for vb.net Pin
WetRivrRat24-Jun-05 22:37
WetRivrRat24-Jun-05 22:37 
GeneralRe: variable queries for vb.net Pin
Colin Angus Mackay25-Jun-05 2:38
Colin Angus Mackay25-Jun-05 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.