college_amy
Regular
- Joined
- Jan 3, 2004
- Messages
- 83
Ok.. Here is what I am trying to accomplish:
I have a webpage that I want users to be able to search for something by state and type of service.. when the results are displayed I want the user to be able to get more information about a specific result by clicking on it and having it open a new page with many details.
Here is what I have to accomplish this:
Access database with 4 tables that contain bits and pieces of the necessary information to be displayed in the detailed page.
I can successfully create a dataset that joins the two tables of which the state and service are housed. My dataview is acting crazy but I know I am missing something and don't know the best way to fix it - but it does kinda work....
My first task is to get the displayed results (not detailed displayed yet) to show up correctly - obviously. Right now when I select a state and service.. the 1st time.. it shows the correct result of the test record. But when I purposely ask it to display the same state with a different service that is NOT going to provide any records, it still shows the same record from the first search, which it shouldn't be doing. now, when I select a state that I know does not have a result, it does properly display the message of no records returned. But if I select ANY state that has a record with that state name, no matter what service I pick, it displays the answer... so it isn't checking to make sure the service is a "Yes" like displayed in my sql statement below.
So that leads me to conclude 1/2 of my program is working correctly but I don't know how to get the other part to check correctly. PLEASE HELP! BY the way, I am not getting an error.
Here is part of my code: (all the stuff important to this problem)
<CODE>
Setup the SQL String
'SQLString = "SELECT billing.state, info.'" & prof.SelectedItem.Value & "'" & _
'"FROM billing " & _
'"INNER JOIN info " & _
'"ON billing.LoginID = info.LoginID " & _
'"AND billing.state ='" & state.SelectedItem.Value & "' " & _
'"AND info.'" & prof.SelectedItem.Value & "' ='Yes'"
'Add two tables to the dataset
SQLString ="SELECT * From billing WHERE state = '" & state.SelectedItem.Value &"'"
DBAdapter = New OleDbDataAdapter(SQLString, DBConnection)
DBAdapter.Fill(DBDataSet, "billing")
DBAdapter.SelectCommand = New OleDbCommand( "Select * From info Where '" & prof.SelectedItem.Value & "' ='Yes'", DBConnection)
DBAdapter.Fill(DBDataSet, "info")
'Close the connection
DBConnection.Close()
'Add the Relations
DBDataSet.Relations.Add( _
"billing_info", _
DBDataSet.Tables( "billing" ).Columns( "LoginID" ), _
DBDataSet.Tables( "info" ).Columns( "LoginID" ) )
DBDataView = New DataView(DBDataSet.Tables("billing"))
If DBDataSet.Tables("billing").Rows.Count = 0 Then
err.Text = "No matching records"
working.Visible="false"
Else
err.Text="Search is Complete!"
working.Visible="true"
Pro_Display.DataSource = DBDataView
Pro_Display.DataBind()
</CODE>
I have a webpage that I want users to be able to search for something by state and type of service.. when the results are displayed I want the user to be able to get more information about a specific result by clicking on it and having it open a new page with many details.
Here is what I have to accomplish this:
Access database with 4 tables that contain bits and pieces of the necessary information to be displayed in the detailed page.
I can successfully create a dataset that joins the two tables of which the state and service are housed. My dataview is acting crazy but I know I am missing something and don't know the best way to fix it - but it does kinda work....
My first task is to get the displayed results (not detailed displayed yet) to show up correctly - obviously. Right now when I select a state and service.. the 1st time.. it shows the correct result of the test record. But when I purposely ask it to display the same state with a different service that is NOT going to provide any records, it still shows the same record from the first search, which it shouldn't be doing. now, when I select a state that I know does not have a result, it does properly display the message of no records returned. But if I select ANY state that has a record with that state name, no matter what service I pick, it displays the answer... so it isn't checking to make sure the service is a "Yes" like displayed in my sql statement below.
So that leads me to conclude 1/2 of my program is working correctly but I don't know how to get the other part to check correctly. PLEASE HELP! BY the way, I am not getting an error.
Here is part of my code: (all the stuff important to this problem)
<CODE>
Setup the SQL String
'SQLString = "SELECT billing.state, info.'" & prof.SelectedItem.Value & "'" & _
'"FROM billing " & _
'"INNER JOIN info " & _
'"ON billing.LoginID = info.LoginID " & _
'"AND billing.state ='" & state.SelectedItem.Value & "' " & _
'"AND info.'" & prof.SelectedItem.Value & "' ='Yes'"
'Add two tables to the dataset
SQLString ="SELECT * From billing WHERE state = '" & state.SelectedItem.Value &"'"
DBAdapter = New OleDbDataAdapter(SQLString, DBConnection)
DBAdapter.Fill(DBDataSet, "billing")
DBAdapter.SelectCommand = New OleDbCommand( "Select * From info Where '" & prof.SelectedItem.Value & "' ='Yes'", DBConnection)
DBAdapter.Fill(DBDataSet, "info")
'Close the connection
DBConnection.Close()
'Add the Relations
DBDataSet.Relations.Add( _
"billing_info", _
DBDataSet.Tables( "billing" ).Columns( "LoginID" ), _
DBDataSet.Tables( "info" ).Columns( "LoginID" ) )
DBDataView = New DataView(DBDataSet.Tables("billing"))
If DBDataSet.Tables("billing").Rows.Count = 0 Then
err.Text = "No matching records"
working.Visible="false"
Else
err.Text="Search is Complete!"
working.Visible="true"
Pro_Display.DataSource = DBDataView
Pro_Display.DataBind()
</CODE>